Replace for with for each