Spectral difference function added