implement treefy() for pretty printing