Refactor the rotate.