updated combinations function, and implemented an independent count_change function