Permutation fully working