Updated main_event_loop to actually process events