Fixed the numberOfCombinatons method, and some speed enhancments