Refactoring servlet