function events=wheel_recreator(recording, threshold)
%takes recorded traces, uses template match to find candidate events, extracts these

event_jitter=50;
window_length=600;

fastemplate=monoexprisedecay_template_generator([3.8220474640796   8.1199740641106   161.9698204414286 0 1],1:50);

events=[];
for i=1:size(recording,2)
    crit=template_based_mini_detector(recording(:,i)',fastemplate);
        
    crit_peaks=find_peaks_within_threshold_crossing_regions(threshold,event_jitter,crit)
    
    for j=1:length(crit_peaks)
        if size(recording,1)>(crit_peaks(j)+window_length) && crit_peaks(j)>100
            wav=recording(crit_peaks(j)-100:crit_peaks(j)+window_length,i);
            wav=wav-mean(wav(1:99));
            events=[events wav];
        end
    end
end