Plot fft output
Some fixes
Refactoring