Added substitution of duplicates