Internal refactor to master cmd

First-pass breakup of logical components into function calls for general
maintainability, refactorability, merge-conflict-avoidance, etc.
Only the ones we need should be part of this.  This is refactoring to something that isn't a design, and I'd prefer we only refactor to things we need.