Added Daves code to the main program