change for_each so that it returns passed function object