works now with combinations and permutations