perform initial inserts into temporary duplicates table; clean up tables after completion; clean up syntax