fixing queries for games/teams, refactor similar queries