Refactored rotation exercise.