MADS: General cleanup and minor fixes