Changed client.py to have better generality.