Adjust main loop