update: main loop