diff --git a/delay.h b/delay.h
index 75459b0..f06c609 100644
--- a/delay.h
+++ b/delay.h
@@ -504,7 +504,7 @@ namespace delay {
 			}
 			
 			if (minimumPhase) {
-				signalsmith::FFT<Sample> fft(windowedSinc.size()*2, 1);
+				signalsmith::fft::FFT<Sample> fft(windowedSinc.size()*2, 1);
 				windowedSinc.resize(fft.size(), 0);
 				std::vector<std::complex<Sample>> spectrum(fft.size());
 				std::vector<std::complex<Sample>> cepstrum(fft.size());
diff --git a/fft.h b/fft.h
index d3ec177..98fcf49 100644
--- a/fft.h
+++ b/fft.h
@@ -8,9 +8,8 @@
 #include <complex>
 #include <cmath>
 
-namespace signalsmith {
+namespace signalsmith { namespace fft {
 
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
 	namespace _fft_impl {
 
 		template <typename V>
@@ -63,7 +62,6 @@ namespace signalsmith {
 			}
 		};
 	}
-#endif
 
 	template<typename V>
 	class FFT {
@@ -119,8 +117,8 @@ namespace signalsmith {
 			if (!foundStep) {
 				for (size_t i = 0; i < subLength; ++i) {
 					for (size_t f = 0; f < factor; ++f) {
-						V phase = 2*M_PI*i*f/length;
-						complex twiddle = {std::cos(phase), -std::sin(phase)};
+						double phase = 2*M_PI*i*f/length;
+						complex twiddle = {V(std::cos(phase)), V(-std::sin(phase))};
 						twiddleVector.push_back(twiddle);
 					}
 				}
@@ -200,8 +198,8 @@ namespace signalsmith {
 					for (size_t f = 0; f < factor; ++f) {
 						complex sum = working[0];
 						for (size_t i = 1; i < factor; ++i) {
-							V phase = 2*M_PI*f*i/factor;
-							complex twiddle = {std::cos(phase), -std::sin(phase)};
+							double phase = 2*M_PI*f*i/factor;
+							complex twiddle = {V(std::cos(phase)), V(-std::sin(phase))};
 							sum += _fft_impl::complexMul<inverse>(working[i], twiddle);
 						}
 						data[f*stride] = sum;
@@ -505,7 +503,6 @@ namespace signalsmith {
 	struct ModifiedRealFFT : public RealFFT<V, FFTOptions::halfFreqShift> {
 		using RealFFT<V, FFTOptions::halfFreqShift>::RealFFT;
 	};
-}
 
-#undef SIGNALSMITH_FFT_NAMESPACE
-#endif // SIGNALSMITH_FFT_V5
+}} // namespace
+#endif // include guard
diff --git a/spectral.h b/spectral.h
index 150bd2c..b6aa695 100644
--- a/spectral.h
+++ b/spectral.h
@@ -25,7 +25,7 @@ namespace spectral {
 	 */
 	template<typename Sample>
 	class WindowedFFT {
-		using MRFFT = signalsmith::ModifiedRealFFT<Sample>;
+		using MRFFT = signalsmith::fft::ModifiedRealFFT<Sample>;
 		using Complex = std::complex<Sample>;
 		MRFFT mrfft{2};