Francis liberty issue 973 generators copy

Fix cycles algorithm by adding list()

Clean whitespace and formatting

Rework condensation to avoid use of list()