Added input validation for the orientation