KRACOEUS-8490: better exception handling, other minor cleanup
Merge pull request #1252 from leoherbie/KRACOEUS-8490

KRACOEUS-8490: better exception handling, other minor cleanup