consolidated rotate code into own class