Split plot_cic script into functions so we can have both sin and square waves.
Strip trailing newlines.