refactoring to match httpy interface