 void handleNotFound() {
   Serial.print("\t\t\t\t URI Not Found: ");
   Serial.println(server.uri());
-  server.send ( 200, "text/plain", "URI Not Found" );
+  // TODO send redirect to /? or just use handle_root?
+  server.send(200, "text/plain", "URI Not Found");
 }
 
 void handle_root() {
   Serial.println("serving page notionally at /");
-  String toSend = html;
-  //toSend.replace("TGT0", LEDstate[0] ? "y" : "b");
-  //toSend.replace("TGT2", LEDstate[2] ? "y" : "b");
+  String toSend = pageTop;
+  toSend += pageTop2;
+  toSend += pageDefault;
+  toSend += pageFooter;
   server.send(200, "text/html", toSend);
   delay(100);
 }
 
 String genAPForm() {
-  String f = apChoice;
-  String buf = "";
+  String f = pageTop;
+  f += ": Wifi Config";
+  f += pageTop2;
+  f += "<h2>Choose a wifi access point to join</h2><p>\n";
+
   const char *checked = " checked";
 
   int n = WiFi.scanNetworks();
   Serial.println("scan done");
   if (n == 0) {
     Serial.println("no networks found");
-    f =
-      "<html><head><title>WaterElf Aquaponics Helper: Wifi Config</title>"
-      "<style>body{background:#FFF;color: #000;font-family: sans-serif;}</style>"
-      "</head><body><p>No AP data :-(<br/>"
-      "<a href='/'>Back</a><br/><a href='/wifi'>Try again</a></p>"
-      "<p><a href='/'>WaterElf Home</a> "
-      "<a href='https://www.fish4tea.net/'>Fish4Tea</a></p></body></html>"
-      "</body></html>";
+    f += "No wifi access points found :-( ";
+    f += "<a href='/'>Back</a><br/><a href='/wifi'>Try again?</a></p>\n";
   } else {
     Serial.print(n);
     Serial.println(" networks found");
+    f += "<form method='POST' action='chz'> ";
     for (int i = 0; i < n; ++i) {
       // print SSID and RSSI for each network found
       Serial.print(i + 1);

    WiFi.begin(ssidchars, keychars);
  }

  server.send(200, "text/html", toSend);
  delay(100);
}

void handle_L0() { handle_root(); } 
void handle_L2() { handle_root(); }
void handle_ALL() { handle_root(); }

      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
      delay(10);

      f.concat("<input type='radio' name='ssid' value='");
      f.concat(WiFi.SSID(i));
      f.concat("'");
      f.concat(checked);
      f.concat(">");
      f.concat(WiFi.SSID(i));
      f.concat("<br/>\n");
      checked = "";
    }
    f += "<br/>Pass key: <input type='textarea' name='key'><br/><br/> ";
    f += "<input type='submit' value='Submit'></form></p>";
  }
  Serial.println("");

  f += pageFooter;
  return f;
}

