Billy's rotation code