Do we want to modify this to use argparse?  And do we want to split into library and script code?