added validation permutation function + rewrote the permutation code

need to make the "useful" permutations do soemthing.