merge old and new version of trdistrv.py