 #include "ArduinoJson.h";
 #include "Data.h";
 
+//Initialize Pins
 const int backPin = 16;
 const int rShoulderPin = 15;
 const int rUnderarmPin = 14;
 const int lShoulderPin = 18;
 const int lUnderarmPin = 17;
 const int buttonPin = 0;
-/*
-int backValue = -1;
-int lShoulderValue = -1;
-int rShoulderValue = -1;
-int lUnderarmValue = -1;
-int rUnderarmValue = -1;
-*/
+
+//Strings of json to update
 String jsonString;
 String oldJSON;
 
+//Data for json
 const char* leftArmData;
 const char* rightArmData;
 const char* backData;
 String type = "out";
 const char* name;
 
+//Buffer for json parsing
 //Could potentially take up too much memory
 DynamicJsonBuffer jsonBuffer;
 bool updated = false;
 
+//For smoothing of data
+bool prevBackData[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+bool prevLeftData[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+bool prevRightData[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+int counter = 0;
+
+int prevBackCount = 0;
+int prevLeftCount = 0;
+int prevRightCount = 0;
+
+
+//Setup
 void setup() {
   Serial.begin(9600);
   pinMode(buttonPin, INPUT);
 }
 
+//Run loop continuously
 void loop() {
   String content = "";
   char character;
 
   while(Serial.available()) {
-      character = Serial.read();
-      content.concat(character);
-      updated = true;
+    character = Serial.read();
+    content.concat(character);
+    updated = true;
   }
 
   if (updated) {

    rightArm = armAtSideRight();
  }

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

  bool back = false;
  
  //Evaluate
  //checks left arm data
  if (strcmp(leftArmData, "fwd45")==0) {
    leftArm = armFwdLeft45();
  } else if (strcmp(leftArmData, "fwd90")==0) {
