Switched to using permutations instead of combinations