Fix multi-monitor / full-screen problems and clean up the code a