connection code added to client.c