Extract the #event_loop method
Cleanup unused and private methods