Added the loop functionality to the MainDriver.