Rationalize exception handling a bit and setup logging