Refactored arg parsing.