add printTree function