Refactor core for better error handling

PR'ing so we can better comment.

First of all this is looking pretty nifty.
Is this really needed ?