Small refactoring of the Query builder part