Orientation detection added