RPC refactoring