added smoothing option