some refactoring & server statistic implemented