Added logic for Connection to server.