Add new permutation code