main loop work in progress