adding main loop. wip