add code for permutations