Added orientation check