added a call to exit() at the end of the program