Avoid doubled looping
More restructuring