wrote smoothing functions, needs a bit more work