Window creation, main loop.