Simplify by taking a functor.
Simplify by providing a chain visit function.