do_request refactoring