More code re-factoring.
Provenance not quite as good as it used to be, but the code is much more managable now.