Refactoring the command line bits to branch on a map -- moves the logic for the separate commands into their own functions.