minor changes

added pause at end of program
added some error checking