refactor to use do_request