Yet another massive refactoring of the previous commit
* If this whole pull request looks like it's going to make it to
  the finish line, I'll rebase everything into a single commit and
  author a reasonable commit message!