tweak main tool to handle exceptions

#19