Optimize duplication elimination.