permutation function added