rpc refactoring