refactor api_ref_call