 
 struct HttpCommand {
   char* cmd;
-  void (*func)(YunClient);
+  void (*func)(YunClient&);
 };
 
 void eventCallback(StatusEvent event);

void loop() {
  // handle slow cooker functions.
  slowcooker.loop();
  
  // Get clients coming from server
  YunClient client = server.accept();


  delay(50); // Poll every 50ms
}

void process(YunClient& client) {
  // read the command
  String command = client.readStringUntil('/');

  // handle /state with no trailing /
  if (command[command.length() - 2] == 0xD && command[command.length() - 1] == 0xA) {
    command = command.substring(0, command.length() - 2);
  }

  int i = 0;
  while (1) {
    if (http_endpoints[i].cmd == 0)
      break;

    if (command.equals(http_endpoints[i].cmd)) {
      http_endpoints[i].func(client);
      return;
    }

    i++;
  }
  client.println(F("Status: 404"));
  client.println();
  client.println(F("{\"error\":\"Command not found.\"}"));
}

void eventCallback(StatusEvent event) {
  switch (event) {
    case EVENT_LID_OPENED:
      Serial.println("EVENT: LID Openned.");
      sendEvent(EVENT_LID_OPENED);
