generalized the request function