option parsing code