refactoring, rotate programatically