Adds The exhaustive search algorithm and updates the previous grouping code