Implemented the new group same team matching algorithm