clean up rotation code