Added test_main_loop