Refactored argument parsing