Changed VectorLayers to OptionalLayers and fixed template layers