Main loop abstraction library