Rework the dup check to read better