Move team query into its own class