Revert "Updated foreach loop again after the revert of commit 1b24a6d40786f28c4c52b544ff33ecb08e197eaa"

This reverts commit d1f6ba6304e868d79b8b19e695e90f25b9a7f870.