revised client.c