done some smoothing for starting and ending