some refactoring in reading servlet