Improved command line handling