Refactor command line parsing.