Refactoring the QueryServer Command