Unnested conditional loop

Conditional was too nested, making it flatter