Refactor argument-parsing.