updated to ensure no duplicate records