tree service refactoring