refactor option parser.