permutation function is working but it's not applying multiple cycles