edited to limit smoothing