refactoring of the servlet