rewrote client.py