AllMatrices refactored to MatrixIterator, AllSubsets to SubsetIterator