abstracted out TreeReader common stuff to TreeBuilder