improved the create_request function