heavily revised test.py file -KL