 
   return (241.88 * T) / (17.558-T);
 }
+
+// Fahrenheit to Celsius formula
+// http://www.rapidtables.com/convert/temperature/how-fahrenheit-to-celsius.htm
+// T(C) = (T(F) - 32) x 5/9
+double fToC(double fahrenheit) {
+  return ((fahrenheit - 32) * 5/9);
+}
+
+// Common JSON response headers to allow remote API calls
+void remoteJSONHeaders() {
+  YunClient client = server.accept();
+  client.println("Status: 200");
+  client.println("Content-type: application/json");
+  client.println("Access-Control-Allow-Origin: *");
+  client.println(); //mandatory blank line
+}
        client.print("\"title\":\"Heat Index\",");
        client.print("\"value\":\"");
        client.print(hif);
        client.print("\"}");
      }


      }
      
      if (request == "tempc") {
        remoteJSONHeaders();

        // JSON response
        client.print("{\"type\":\"temperature\",");
