 byte    timeout       ;    //Maximum loops allowed to look for the next bit transition 
 byte    loopCount     ;    //Incremented inside the loop looking for next bit transition
 //variables for Header detection
-byte    headerBits = 15;   //The number of ones expected to make a valid header
+byte    headerBits = 10;   //The number of ones expected to make a valid header
 byte    headerHits = 0;    //Counts the number of "1"s to determine a header
 boolean firstZero  = false;//has it processed the first zero yet?  This a "sync" bit.
+word    nosHits    = 0;    //number hex dumps achieved (not necessarily error free, just hits!)
 //Variables for Byte storage
 byte    discards   = 0;    //how many leading "bits" need to be dumped, usually just a zero if anything eg discards=1
 byte    dataByte   = 0;    //Accumulates the bit information

  }
  timeout=lDelay/5;//Rough number to indicate max loops allowed, if exceeded usually wrong polarity chosen, heals itself if wrong
  Serial.print(timeout,DEC);
  Serial.println(" timeout for wrong Polarity");
  Serial.println("P 00 00001111 01 22223333 02 44445555 03 66667777 04 88889999 05 AAAABBBB 06 CCCCDDDD 07 EEEEFFFF 08 00001111 90 22223333"); 
  Serial.print("sDelay =");
  Serial.println(sDelay,DEC);

        //data transition detection must swap, so it loops for the opposite transition in the next bit waveform
        tempBit = tempBit^1;
      }//end of detecting no transition at end of bit waveform
      //when looping to detect the transition in middle of bit waveform it must never take too long
      if(loopCount>timeout){
        noErrors=false;//not allowed to sync on an incorrect transition
        //if in the header phase and looking for the sync 0 
        if ((!firstZero)&&(headerHits>headerBits)){
          //ending here means the zero was found but polarity was wrong
          //Serial.println(loopCount,DEC);//enable for debugging
          polarity = polarity^1;//switch polarity and try for next packet
          //Serial.print("Polarity now =");
          //Serial.println(polarity,DEC);
        }
