def _checkup(peaks, ecg_integrated, sample_rate, rr_buffer, spk1, npk1, threshold):
    peaks_amp = [ecg_integrated[peak] for peak in peaks]
    definitive_peaks = []
    for i, peak in enumerate(peaks):
        amp = peaks_amp[i]
        if amp > threshold:
            definitive_peaks, spk1, rr_buffer = _acceptpeak(peak, amp, definitive_peaks, spk1,
                                                            rr_buffer)
        elif amp > threshold / 2 and list(definitive_peaks) and len(peaks) > i + 1:
            mean_rr = numpy.mean(rr_buffer)
            last_qrs_ms = (peak - definitive_peaks[-1]) * (1000 / sample_rate)
            last_qrs_to_next_peak = peaks[i+1] - definitive_peaks[-1]
            if last_qrs_ms > 360 and last_qrs_to_next_peak > 1.5 * mean_rr:
                definitive_peaks, spk1, rr_buffer = _acceptpeak(peak, amp, definitive_peaks, spk1,
                                                                rr_buffer)
            else:
                npk1 = _noisepeak(amp, npk1)
        else:
            npk1 = _noisepeak(amp, npk1)
        threshold = _buffer_update(npk1, spk1)
    definitive_peaks = numpy.array(definitive_peaks)
    return definitive_peaks