v5.5.2 - fix tree algorithm to actually work ; add debugging