Refactor marking duplicates to move metrics to separate functions.