Refactor based on code review

- move code out of API
- remove CookieManager as Apache Http Client handles this
- indent