Refactored display code to be more flexible with different screens