Added compiled permutation code