Refactored orientation check
Refactored orientation check
Refactored constants
Large refactoring