Add support for dt, dd. Refactor. Fix some broken tests.