added 2nd stage dedupe code