Used $index instead of name to also work with not-selector–compliant names.