added better option parsing