Utility for replacing keys