Done: waveform functions - not yet tested