added preorder tree traversal