Permutations duplicates extracted into separate method