refactoring to eventually support custom request handling