working implementation of the client