Rotation algorithmn implemented