tweak main tool to handle exceptions

second try on this.  Changes from
last commit made unit tests fail,
made fixes

#19