refactoring of rpc_service