Replaced Each with While