added fullscreen support and cleaned code