modified to also test permutations