rotation fixed. some refactoring.