added code for running search over the tree