Improve API error handling
Remove debuggery
Merge pull request #45 from contolini/dev

Improve API error handling