added command line flag for waveform viewing
added error code for wave form viewing