Add get_main_instance() and main_window_loop()