Refactored if block which calculates scaling factor in function New of waveform.go