Use OptionParser to parse command line options. Refactor and extract a class