Added fft for x and y. Not optimization yet.