QueryServlet refactor