 }
 
 void printValue(long value){
+  printValue(value, 1);
+}
+
+void printValue(long value, short separator){
   if (!isnan(value))
   {
-    Serial.print(value); Serial.print(", ");
+    Serial.print(value); 
   }
   else
   {
-    Serial.print("'NaN', ");
+    Serial.print("'NaN'");
+  }
+  
+  if (separator){
+    Serial.print(", ");
   }
 }
 

  if (lx == 0 && broadband > 65000){ //Sensor appears to be in direct sunlight outside it's resolution limits. Set lx value to max to simplify downstream logic
      lx = 0xFFFF;
  }
  Serial.print("'AmbientLight':"); printValue(lx);
  Serial.print("'BroadbandLight':"); printValue((long)broadband);
  Serial.print("'Infrared':"); printValue((long)infrared);

  Serial.println("}}");
  

    }
    return 0;
}

char getCh(){
  if (Serial.available()){
