added a computation of an arbitrary index to optimize the generation of subsets significantly