cleanup the rotation code