added code to detect duplicates and delete from ACC_TEMP