start reimplementing TermDiff