Simpler algorithm, decoupling generation