Refactor index key validation and normalisation.