tidying up argument parsing