Fixing tree API.
test
Add tests for tree.
Merge branch 'APIDesign'