verified generation algorithm works