Added screen and mode detection.