state support, for_each refactoring