Significant refactoring to take the API error checking out of the library and leave it to the API itself.
Update the examples to work after the refactoring