optimized set_DM