Handles duplicates in tables