Replace for_each with simple for.