added findDuplicates
permute added