better error handling
Merge pull request #4 from tim-savage/develop

better error handling