Minor fixups
Add rudimentary exception handling