building in main loop