added keyIndex method