add ability to group by team
refactor