Refactored fftx and ifftx into one