Would it not be simpler to `splice` new entries rather than `duplicateAndReplace`?