Uses optparse to parse options.