Uses sentinel loop for the main program