Changed the generation algo