Add query class for initial rewrite