function [cleaned_vector, spectrogram_output,suspected_noisy_indxs,Thresh]=significant_noise_peak_detector_misleader_cleaner(vector_to_clean,samples_in_batch,threshold)
AA=abs(spectrogram(diff(vector_to_clean),samples_in_batch));
siz=size(AA);
%surf(AA)
%  subplot(2,1,1)
%  plot(AA(1,:))
%%  Clean High Frequencies
Thresh=threshold*mean(smooth(AA(end,:)));
Thresh_low_freq=1.3*threshold*mean(smooth(AA(1,:),3));
Thresh_mid_freq=8*mean(smooth(AA(15,:),3));

%%
cleaned_vector=vector_to_clean;
vv=smooth(AA(end,:),7);
vvv=smooth(AA(1,:),4);  %Optimization counter  vvv=smooth(AA(1,:),4); 
vvvv=smooth(AA(15,:),4);

y = resample(vv,numel(vector_to_clean),numel(vv));
z = resample(vvv,numel(vector_to_clean),numel(vvv));
w = resample(vvvv,numel(vector_to_clean),numel(vvvv));
[suspected_noisy_indxs]=find((y>0.8*Thresh)+(z>Thresh_low_freq)+(w>Thresh_mid_freq));
%cleaned_high_freq=sum((z>Thresh_low_freq));

cleaned_vector(suspected_noisy_indxs)=[];
% plot(vector_to_clean)
% hold on
% plot(cleaned_vector)
% plot((diff(cleaned_vector)))
% hold on
% plot(medfilt1(diff(cleaned_vector)))


spectrogram_output=(AA);
