Working collapse code

…with flatten
Collapse code working

… with flatten
Delete junk files