Changed loop to for each.