updated code for client