Cleanup main() to consolidate the different option actions into
functions. Change from a set of if blocks to a switch.