added smoothing part