change each closure into for loop