implement smoothing