refactored argument parsing