Updated so we only clear the keys on successful clears.