better smoothing algo