Revert Revert DTK rewrite

Reverts revert dtk rewrite and included Merges phire's static fix