Added the ability to limit the number of points used for smoothing