more refactoring of dt
Merge pull request #1612 from WalterBright/refactor11

more refactoring of dt