working implementation of client