Beginning refactoring for new CLI.