tree structure for every function