Clean up and fixes

Signed-off-by: Tim Smart <tim@fostle.com>
Test the error handling some more

Signed-off-by: Tim Smart <tim@fostle.com>