First stab at improved error handling.
Merge pull request #26 from sourishkrout/master

Basis for improved error handling.