Established main loop.