Split each sub-command into separate functions