     if (inChar == '|')
     {
       int endIndex = recString.indexOf("|");
-      /*
-      if (endIndex == -1)
-      {  
-        endIndex = recString.indexOf("/n");
-      }
-      */
+      //start index = inclusive, end index = exlusive (this removes pipe)
+      recString = recString.substring(0, endIndex);
+
       
-      //PROCESS MESSAGE
-      if (recString.charAt(0) == '.' || recString.charAt(0) == '-' {
-        recMessage= recString.substring(2, endIndex);
-        Serial.print("Received Message:");
-        Serial.println(recMessage);
-        
+      //PROCESS MORSE CODE
+      if (recString.charAt(0) == '.' || recString.charAt(0) == '-') 
+      {
+        //Add to Queue
+      }
+   
       //PROCESS SEQUENCE  
-      }
-      if (recString.charAt(0) == 's') {
-        seqSize = (recString.length()-1)/2;
-        /*
-        int* seq = new int[(recString.length()-1)/2];
-        Serial.println(sizeof(*seq));
-        for (int i = 2; i < recString.length(); i++)
-        {
-        }
-        */
-        /*
-        for (int i = 2; i <= (seqSize*2); i += 2)
-        {
-          seqArr[i/2 -1] = recString.charAt(i) - '0';
-        }
-        /*
-        Verify that you can actually create arrays of variable size
-        Serial.print("Created array size: ");
-        Serial.println(sizeof(seqArr) / sizeof(int));
-        
-        //Test Sequence Array
-        for (int i = 0; i < digits; i ++)
-        {
-          Serial.println(seqArr[i]);  
-        }
-        */
-        /*
+      else 
+      {      
+        for (int i = 0; i < recString.length(); i ++)
+        {
+          seqArr[i] = recString.charAt(i) - '0';
+        } 
+       
         seqIndex = 0;
-        LEDon = false;
-        for (int i = 0; i < 4; i ++)
-          prevBtns[i] = false;
-        arduinoTurn = true;
-      }
-      
-      
-      //Output sequence to user
-      
-
-      
+        seqLength = recString.length();
+        displayingSequence = true;
+        //erase as much of the button log as required to enter the correct sequence
+        for (int i = 0; i < seqLength; i ++)
+          btnLog[i] = -1;
+        btnLogIndex = 0;
+      }
+           
       recString = "";
+      endIndex = -1;
     }
   }
 }

  Serial.println(" ");
  */

  

}

/*
void serialEvent()

 pinMode(led1, OUTPUT);
 pinMode(led2, OUTPUT);
 pinMode(led3, OUTPUT);
 recString.reserve(400);
}


void loop() {

  if(displayingSequence)
  {
    //if an LED has been on and it's time to turn it off
    if(LEDon && (millis() - timeLEDlastChanged >= LEDonDuration))
    {
      digitalWrite(led[seqArr[seqIndex]], LOW);
      LEDon = false;
      seqIndex ++;

      //if the entire sequence has been output
      if(seqIndex == seqLength)
      {
        displayingSequence = false;
        repeatingSequence = true;
        listeningToButtons = true;
        seqIndex = 0;
      }
      timeLEDlastChanged = millis();
    }

    //if the last LED was off and it's time to turn the next one on
    else if (!LEDon && (millis() - timeLEDlastChanged >= LEDoffDuration))
    {
      digitalWrite(led[seqArr[seqIndex]], HIGH);
      LEDon = true;
      timeLEDlastChanged = millis();
    }
    
  }
  
  if(repeatingSequence)
  {
    //see if the user is done pressing buttons
    if(btnLogIndex == seqLength)
    {      
      //now check if correct answer was written
      //I am an optimist
      playerWasCorrect = true;
      for (int i  = 0; i < seqLength; i ++)
      {
        if(btnLog[i] != seqArr[i])
        {
          playerWasCorrect = false;
          break;
        }
      }
      displayResultAnimation = true;
      listeningToButtons = false;
      repeatingSequence = false;
      //clear button log
      for (int i = 0; i < seqLength; i ++)
          btnLog[i] = -1;
      btnLogIndex = 0;
      animationIndex = 0;
      LEDon = false;
      animationIndex = -1;
    }
    
  }

  if(displayResultAnimation)
  {
    if (animationIndex == -1)
    {
      //can't use delays or they will interfere with morse code output
      if (playerWasCorrect)
      {
        animationIndex = 0;
        endI = 11;
        Serial.println("player was correct");
      }
      else {
        animationIndex = 12;
        endI = 18;
        Serial.println("player was wrong");
      }
    }

    Serial.print(LEDon);
    Serial.print("   ");
    Serial.print(millis());
    Serial.print("   ");
    Serial.print(timeLEDlastChanged);
    Serial.print("   ");
    Serial.print(animationIndex);
    Serial.print("   ");
    Serial.println(animationArr[animationIndex]);
    
    

    //if an LED has been on and it's time to turn it off
    if(LEDon && (millis() - timeLEDlastChanged >= animationLEDonDuration))
    {
      digitalWrite(led[animationArr[animationIndex]], LOW);
      LEDon = false;
      animationIndex ++;

      //if the entire sequence has been output
      if(animationIndex == (endI + 1))
      {
        displayResultAnimation = false;
        creatingSequence = true;
        listeningToButtons = true;
        seqIndex = 0;
      }
      timeLEDlastChanged = millis();
      Serial.println("Off");
    }

    //if the last LED was off and it's time to turn the next one on
    else if (!LEDon && (millis() - timeLEDlastChanged >= animationLEDoffDuration))
    {
      digitalWrite(led[animationArr[animationIndex]], HIGH);
      LEDon = true;
      timeLEDlastChanged = millis();
      Serial.println("ON");
    }
  }
  
  if(creatingSequence)
  {
    
  }

  if (listeningToButtons)
  {
    for (int i = 0; i < 4; i ++)
    {
      int cur = digitalRead(btn[i]);
    
      //just saves the time of last change
      if (cur != prevButtonState[i])
        prevChangeTime[i] = millis();
    
      //if enough time has passed that the button is being held down or has been released (intended state)
      if ((millis() - prevChangeTime[i]) > debounceTime)
      {
        if (cur != buttonState[i])
        {
          buttonState[i] = cur;
         
          //now that the new state has been officially changed, make appropriate change
          if (cur)
          {
            btnLog[btnLogIndex] = i;
            btnLogIndex ++;
            digitalWrite(led[i], HIGH);
          }
          else {
            //button released
            digitalWrite(led[i], LOW);
          }
        }
      }
    prevButtonState[i] = cur;
    }
  }

}//end loop



//expect morse code to start with . or - and sequences are in the form 12031021, BOTH END WITH |
void serialEvent()
