Better errors

* Resubmitting pull request with private method to handle HTTP requests and errors consistently.
* Includes new and refactored tests
* Also removes minor dead code for clarity