Stable, replaced recursion with factories