factor out printNode from printloop and crossreference