Put the FFT stuff in its own functions.