added some code for client with cache