refactoring rpc package