Move duplicate check to generic.py