added dupecheck function