Refactor the layer-manager to remove the singleton