Condense rotation code