Changed the generator to generate code that follows new algorithm.