refactor protobuf