drafted main loop