main loop complete