Improving duplication check