Update key matching function