A lot of fixes to tree (most function parsing)