Changes to the main loop