Various refactoring.  Seems stable.