added server connection code