Replace forEach with for..in loops

To prevent issues with evil Array-altering code