     leftArm = armAtSideLeft();
   }
 
+  //checks right arm data
   if (strcmp(rightArmData, "fwd45")==0) {
     rightArm = armFwdRight45();
   } else if (strcmp(rightArmData, "fwd90")==0) {

    rightArm = armAtSideRight();
  }

  if (strcmp(backData, "straight")==0) {
    back = backStraight();
  } else if (strcmp(backData, "fwd")==0) {

    back = backBentBack();
  }

  //add new data to the arrays
  prevBackData[counter] = back;
  prevLeftData[counter] = leftArm;
  prevRightData[counter] = rightArm;

  if (counter < 10){
    counter++;
  } else {
    counter = 0;
  }

  //collect # right
  for (int i = 0; i < 10; i++){
    if (prevBackData[i]){
      prevBackCount++;
    }
    if (prevLeftData[i]){
      prevLeftCount++;
    }
    if (prevRightData[i]){
      prevRightCount++;
    }
  }

  //smooth data
  //if 50% of previous entries are correct
  if (prevBackCount >= 5){
    back = true;
  } else {
    back = false;
  }

  if (prevLeftCount >= 5){
    leftArm = true;
  } else {
    leftArm = false;
  }

  if (prevRightCount >= 5){
    rightArm = true;
  } else {
    rightArm = false;
  }



  //build JSON string
  jsonString = "{\"type\":\"";
  jsonString += type;
