Create main_loop