refactor parseArgs