small rpc refactoring