Changed a for loop

Modifed collection during foreach