Gittrac #1782:  all cleaned up except for a couple of things I need
to check; still needs documentation.