Can you make walkChildren() to run on the current node and its children and rename it to iterate() or foreach()?
It should allow you to have only one line instead of these 4 lines.