updated commenting in generation function