updated version of client.py