added permutation functions