batch curve fitting with pseudo Voigt peaks

Hi there, I am working with X-ray diffraction data recorded in situ over time (few hundred patterns), and I do a lot of batch peak fitting to determine the evolution of a single peak width. I usually work with scaled 2D waves. Batch curve fitting works very well for a quick gaussian fit of a single peak but I would like to be able to use a pseudo Voigt function, and be able to fit two peaks at the same time. Actually, one is from the background and is constant overtime, while the other shifts during the experiment and overlaps with it. I would also like to be able to define a linear background (2 points) as the background isn't perfectly flat. Is it something that could done? Thanks
This is a quick adjustment of a fit function I have used for fitting XPS spectra, just as an example of how you could do it. I have removed the asymmetry and Shirley background parameters from the fit function. I hold the first fit coefficient w[0] constant and use it to contain the number of peaks in the fit, or to be more specific the number of parameters in the fit.
ThreadSafe Function PseudoVoigtFitFunc(w,x):FitFunc
Wave w; Variable x
Variable Result=0, n=0
Variable Position=0, PeakArea=0, FWHM=0, GL=0

    //  Adds the linear background. Intercept=w[1], Slope=w[2]
    //  Adds the peaks one at a time. w[0] contains the number of points in w.
    for (n=3; n<w[0]; n+=4)

    return Result

You can eliminate the need for the number of peaks in w[0], which also eliminates problems caused by forgetting to hold it:

Variable ncoefs = numpnts(w)
Variable npeaks = (ncoefs-2)/4
Variable n
for (n = 0; n < npeaks; n++)
    Variable index = n*4 + 2
    position = w[index]
    PeakArea = w[index+1]
    ... etc ...