better algorithm for combination