refactor Server