Permutations problem resolved