Added generate button functionality