error handling and documentation

Added some error handling and documentation/formatting of code.  Still
cleaning up code.  Also fixed crash on option 9 (Exit)
execution--program would exit but throw a traceback--mitigated
traceback.  Experimenting with a couple of assertions but will probably
remove.