improved vector smoothing algorithm