         //Serial.println("Maximized colors:");
         //best_color.print();
 
-        if (F_CALIBRATING) {
+        #if F_CALIBRATING 
           // If we are calibrating colors
           __calibrating(best_color);
-        } else {
-
-          int min_diff = C_ALLOWED_COLOR_VARIANCE;
-          sortingResult = -1;
+        #else
+          // Compare the reported color with the pre-defined colors in the colorList
+          // and set the result to the color with the least color variance, if the 
+          // variance is still under the allowed variance range (C_ALLOWED_COLOR_VARIANCE)
+    
+          int min_diff = C_ALLOWED_COLOR_VARIANCE; // Set the mininum difference to the allowed color variance
+          sortingResult = -1; // Set the result to -1
+           
           for (int i = 0; i < sizeof(colorList) / 8; i++) {
+            // Compare the reported color with the color defined in the colorList
             C_Color diff = best_color.compare(colorList[i]);
+            
+            // Add the color difference's primary colors (R + G + B) together
             int agg = diff.aggregate();
+            // Check if the aggregated color difference value is less than the minimum color difference
             if (agg < min_diff) {
-              min_diff = agg;
-              sortingResult = i;
-            }
+              // If this is less than the minimun
+              min_diff = agg; // Set the minimun difference to this aggregated color difference
+              sortingResult = i; // Set the result to this color's index
+            }            
           }
-
-        }
-
+        #endif
       }
-
       // Serial.println("Finish measuring.");
       isColorBeingMeasured = false;
       lastSkittleTime = millis();
-
-
     }
   }
 
   // printColors(r, g, b, c);
-
-
 }
 
 void updateColorView() {

// Calibrated Skittle's Colors
// These are the skittle's colors
#define C_COLOR_EMPTY C_Color(61, 88, 72)
#define C_SKITTLE_GREEN C_Color(64, 109, 51)
#define C_SKITTLE_RED C_Color(97, 62, 55)
#define C_SKITTLE_YELLOW C_Color(88, 91, 36)
#define C_SKITTLE_PURPLE C_Color(65, 74, 77)
#define C_SKITTLE_ORANGE C_Color(107, 66, 40)

const C_Color colorList [] = {C_SKITTLE_RED, C_SKITTLE_GREEN, C_SKITTLE_YELLOW, C_SKITTLE_PURPLE, C_SKITTLE_ORANGE};

// Initialize the display with the numbers of the interface pins
LiquidCrystal lcd(PIN_LCD_RS, PIN_LCD_ENABLE, PIN_LCD_D4, PIN_LCD_D5, PIN_LCD_D6, PIN_LCD_D7);
// Create the object for the top continuous rotation servo
Servo servoTop;
// Create the object for the bottom standard servo
Servo servoBtm;
// Create the color sensor object
Adafruit_TCS34725 tcs = Adafruit_TCS34725(C_ATIME, TCS34725_GAIN_1X);


int skittleCount = 0; // The number of skittles sorted
unsigned long lastSkittleTime = 0; // Time when the last skittle was being sorted

  int diff = avg_c.compare(new_color).aggregate();
  Serial.print("Diff: "); Serial.println(diff);
  if (diff > C_ALLOWED_COLOR_VARIANCE) {
    Serial.println("Difference too big. This sample data is discarded.");
  } else {
    avg_c.r = (avg_c.r * count + new_color.r) / (count + 1);
    avg_c.g = (avg_c.g * count + new_color.g) / (count + 1);
