improved groupBy functionalTest