renamed key->keyIndex