Refactoring tree types into layergroups