refactor servlet