Limit number of queries for certain classes