refactoring separating trees