Modify DBfn to incorporate a spline fit to the data.
lines 882+, 868+
The number of spline coefficients can be changed using fitspline=Ncoeff.
In order to do the spline a 3 point moving average is done first to remove any glaring zeros.