reduce N+1 queries in the frontend