 }
 
 void updateColorView() {
-  static int oldSortingResult = -1;
-  if (sortingResult != oldSortingResult) {
-    oldSortingResult = sortingResult;
-    switch (sortingResult) {
+  static int index = 0;
+  unsigned long lastColorSignalTime = 0;
+  if (HAS_RESULT(colorResults[index])) {
+    lastColorSignalTime = millis();
+    switch (colorResults[index]) {
       case 0:
         Serial.println("RED");
         analogWrite(PIN_COLOR_RED, 255);

    avg_c.r = (avg_c.r * count + new_color.r) / (count + 1);
    avg_c.g = (avg_c.g * count + new_color.g) / (count + 1);
    avg_c.b = (avg_c.b * count + new_color.b) / (count + 1);
    count++;
    Serial.println("Average color:");
    avg_c.print();
  }
}

void updateColorSensor() {
  // Is the color sensor measuring the Skittle right now
  static boolean isColorBeingMeasured = false;
  // The best colors during a measuring cycle
  static uint16_t min_clear;
  static C_Color best_color = C_Color(0, 0 , 0);

  /* This function is used to test and get the average color
      of a certain Skittle
  */
  static C_Color avg_c = C_Color(new_color.r, new_color.g, new_color.b, new_color.c);
  static int count = 0;
  int diff = avg_c.compare(new_color).aggregate();
  Serial.print("Diff: "); Serial.println(diff);
