refactor basic server