refactoring serverclient