First attempt for smoothing
Implemented smoothing