refactoring of querybuilder inner classes