add query parsing