Support named modes

Instead of providing `--mode 1` or `--mode 3` you now provide `--mode upload` or `--mode verify_upload`. I also cleaned up some of the error handling code around option parsing.