Mig bk md

Hi Terence,

Sorry about the size of this pull request.  It's a bit rushed.  Could you please review these changes, comments appreciated.

Thanks

Shuang