mdo implementation tidied up a bit.