move query parser to its own class