refactoring the server sdie