Simplify layer index management in layer tree