refactoring of main querybuilder parser