improved command-line parsing