Line profile analysis of X-ray and neutron diffraction patterns is a powerful tool for determining the microstructure of crystalline materials. The Convolutional-Multiple-Whole-Profile (CMWP) procedure is based on physical profile functions for dislocations, domain size, stacking faults and twin boundaries. Order dependence, strain anisotropy, hkl dependent broadening of planar defects and peak shape are used to separate the effect of different lattice defect types. The Marquardt-Levenberg (ML) numerical optimization procedure has been used successfully to determine crystal defect types and densities. However, in more complex cases like hexagonal materials or multiple phases the ML procedure alone reveals uncertainties. In a new approach the ML and a Monte-Carlo statistical method are combined in an alternative manner. The new CMWP procedure eliminates uncertainties and provides globally optimized parameters of the microstructure.