refactoring tree data