Big refactoring - AnalysisQuery use removed