added replace_duplicates flag to ingestion script