alternative generation algorithm