Separate flag for isGenerating. Clarify comments.