       }
       
       if (request == "tempc") {
-        client.println("Status: 200");
-        client.println("Content-type: application/json");
-        client.println("Access-Control-Allow-Origin: *");
-        client.println(); //mandatory blank line
+        remoteJSONHeaders();
 
         // JSON response
         client.print("{\"type\":\"temperature\",");

  // Compute heat index
  // Must send in temp in Fahrenheit!
  float hif = dht.computeHeatIndex(f, h);

  // How cold? (temperature and humidity with Arduino)
  // http://wodieskodie.com/how-cold-temperature-and-humidity-with-arduino/
  float dp = dewPoint(c, h);


  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
}