Add tests and code for "D" and "M"