Internal refactor to master cmd

First-pass breakup of logical components into function calls for general
maintainability, refactorability, merge-conflict-avoidance, etc.
I'm not sure I want API either - let's just do "master" and "node".  You need to add them to the command documentation.