More tree implementation
Refactoring