Documented the walk function.
Use an anonymous function to reduce code repitition.