working client and server code