Enhanced logic for command line processing.