adding tree search functionality