Added grid-of-sets algorithm