Added orientation logic