added query for computing group sizes