ML partial rewrite and tests
Finish ml test of an example