moving option parsing to C