server refactor.