Updated doGenerate