Added comments outlining the steps in the rotate function