add printTree method