Moved all display-specific code from main.c to display.c