Modified to use FFT