added function for permutations