Cleanup

Just a couple of pendantic things with error handling, plus some better comments.
If this doesn't ever happen I'd be tempted to panic here so that the bug is caught explicitly.