More refactoring now with much better exception printout