Tree search function added