Improve duplicate detection