I found that you quite often parse options. I think that for future extensions and also for easier read you can refactor it to own simple method that is not global like
parse_options
construct_options ( or to_options etc. )