added double buffered window, main loop