main loop and so on is done