tweaking ex2.py