implemented rotations function

Not sure if it was the most elegant approach.