adjust rotation code