Add main loop class.