add comments to generate.c