Rationalize command line handling to be less brittle