identified 2 foreach loops