Removal of the child node makes it easier to separate traversal from output generation.
Update
Was there no test coverage for this situation? If not, can you add some?
Rebase
LGTM!