optparse version up, trivial refactoring