How can I correctly setup attachInterrupt() in this sketch?

Is this the critical section your referencing?

noInterrupts ();
ref_count = ref_coil_count;
sensor_count = sensor_coil_count;
interrupts ();

AND THIS

// ESR reference coil function
void ref_coil()
{
noInterrupts (); // turn off Interrupts when counting
ref_coil_count++;
interrupts ();
}