refactor command line parsing.