Remove unneeded keys and add new keys