refactoring protobuf and generation script