Replace ForEach() calls with foreach loops