Minor cleanup: wrap the main commands in their own functions.