Tree function added