Adding treefunc