More tree refactoring