Add new generator2() function