move tree fns to own namespace