Refactored queryParser