As far as I can get.
Remove unused code.
Make measure invariant.
Fix warnings.
Move implicits to Implicits object.
Tidy up names.