Update key function