added full waveform extraction code