Split out some traversal methods and let the generator decide where to output to.