Update Flattening Algorithm to the same style as the other algorithms

No changes to the algorithm itself.