small changes to tdt.py. Still ongoing