Replace internal uses of each with for