First implementation of smoothening.