Rotate function implemented.