new unit tests and examples for quadratic time MMD

and some minor cleanups/fixes