reverted for loops back to for in