Improved argument parsing logic