Trigger to catch duplicates
Minor error correction