Refactor servlet