example main loop.