Lots of work.

So many changes I can't remember the diffs.