final changes for group_by block