better option parsing, refactorings