move web_permutation function to function script