copied over smoothing, untested though
added todo