Add more functionality and refactor

- Support canceling
- Support clearing cache
- Refactor reponse handling to centrally handle errors