error handling improved #170
Merge pull request #171 from artyfarty/master

Improved error handling