Rationalise & reduce memory usage.
Do the windowing in the frequency domain.
Clean up freq-domain windowing slightly.
Use windowing for the peak detection.
The windowing is applied in the frequency direction.