Small refactoring
Refactoring and Fix bug with rotation