Internal refactor to master cmd

First-pass breakup of logical components into function calls for general
maintainability, refactorability, merge-conflict-avoidance, etc.
I don't really want this :)

I think I want roles, like "master", "node", and "api".  I'll think through it.