revise smoothing code