Working client and server code