Orientation detection added.