refactorings of connection and server
finsished up prototype refactoring for server class