touched up main loop