Cleanup

Just a couple of pendantic things with error handling, plus some better comments.
I guess that idiom is common enough it doesn't really detract from clarity.