changed self back to Collection when constructing objects in groupBy