add print tree function