Improved argument parsing logic and checks