More on the main loop logic