An improved background subtraction technique using cubic splines is pr
esented. With this method one is able to suppress oscillations of the
spline background by varying a tuning parameter. By changing this tuni
ng parameter one can control the amount of a positive quantity, relate
d to the curvature of the background function, that is added to the ch
i(2) sum for a given spline background. Minimizing the sum of squares
plus the positive term results in very good background fits and even c
omplicated data can be handled. Furthermore, incorporated in the algor
ithm is the additional capability to reduce, or even remove, sudden ju
mps in the data, which may have been caused by multiple diffraction in
the single-crystal monochromator.