Cleans QueryHelper and fixes some issues