Adds TD.scala, with a whole bunch of other changes.