made function to geenerator