       rc_state = RC_WAIT;
           
       attachInterrupt(RC_INTERRUPT, ISR_rise, RISING);
+}
+void ISR_rise()
+{
+    noInterrupts();
+
+    if (rc_state != RC_WAIT)
+    {
+      if (!synced)
+      {
+        unsigned int elapsed = micros() - last_fallingedge_time;
+        if (elapsed > LONG_DEADZONE_THRESHOLD)
+        {
+          RC_results[rc_index] = micros();
+          synced = true;
+          rc_index = 1;
+        }
+      }
+      else
+      {
+        RC_results[rc_index] = micros();
+      }
       attachInterrupt(RC_INTERRUPT, ISR_fall, FALLING);
-}
-void ISR_rise()
+    }
+    
+    interrupts();
+}
+void ISR_fall()
 {
     noInterrupts();
-    unsigned long time = micros();
-    for (register int i = 0; i < 8; i++)
+    
+    if (rc_state != RC_WAIT)
     {
-        register int index = (rc_index+i)&7;
-        if (PIN_ORDER[index] == 0)
-            continue;
-        if (digitalRead(PIN_ORDER[index]) == HIGH)
+      if (!synced)
+      {
+        last_fallingedge_time = micros();
+      }
+      else
+      {
+        RC_results[rc_index] = micros() - RC_results[rc_index];
+        rc_index++;
+        if (rc_index == 7)
         {
-            rc_index = (rc_index+i) & 7;
-            RC_results[rc_index] = time;
-            rc_state = RC_PROCESSING;
-            if (rc_index == 1)   // first signal of group
-                RC_results[0] = RC_results[1];  // log starting time
-            
+          rc_index = 1;
+          rc_state = RC_DONE;
         }
+      }
+      attachInterrupt(RC_INTERRUPT, ISR_rise, RISING);
     }
     interrupts();
 }
-void ISR_fall()
-{
-    noInterrupts();
-    if (PIN_ORDER[rc_index] != 0 && digitalRead(PIN_ORDER[rc_index]) == LOW)
-    {
-        unsigned int elapsed = RC_results[rc_index] - micros();
-        if (elapsed > MAX_RC)
-        {
-            RC_results[rc_index] = INVALID_DATA;
-            if (rc_index == 7)
-                rc_state = RC_DONE;
-        }
-        else if (elapsed < MIN_RC)
-        {
-            RC_results[rc_index] = elapsed;
-            if (rc_index == 7)
-                rc_state = RC_DONE;
-        }
-        else; // spurious interrupt; wait for the next.
-    }
-    interrupts();
-}
 void loop()  {
     unsigned long Start_us = micros();
+    
+    startCapturingRCState();
+    
     unsigned long local_results[7];
     while (rc_state != RC_DONE)
         ;

volatile int rc_index = 0;
volatile  unsigned long RC_results[7];
volatile int rc_state = RC_WAIT;

void setup()
{ //Set up pins

#include <SPI.h>

//RC input values - pulse widths in microseconds
const int LONG_DEADZONE_THRESHOLD = 10000; // used for syncing to determine if the last down time was the long down zone
const int DEAD_ZONE = 75;
const int MIDDLE = 1510;  // was 1322;
// extremes of RC pulse width
