refactored command line processing.  Fix cortex bug.
updated test scripts for command line mode