renamed "legend" to "layer"