Fixed rotate code