Refactoring the outermost structure of the formatter.

This is the last step of pure shuffling stuff around, the next step will
be the actual feature.