added device orientation detection.