Tweaked the signal generator algorithm