Patched rotation code.