refactoring HTTP requests