Tweaks to MDS code and added Makefile hook for it.