added Query class that filters large database based on type of query