Implementing smooth() function.