2-pass duplicate search