Converted loop to use for_each.