Implemented ''shake'' function