Restructured get_best_groups() method

still need to improve efficiency, check the groups and make results
formatted nicely.