Variable key overwrite dmt

Sibling PR to #260 and #259 - targetted for master branch