         server.send( 400,  textplainHEADER, "Invalid percentage." );
         return;
       }
-      channel[thisChannel].minimumLevel = thisPercentage;
+      channel[channelNumber].minimumLevel = thisPercentage;
       //writeMinimumLevelFile();
       server.send( 200,  textplainHEADER, "Minimum level set." );
       return;

  });

  server.on( "/api/setchannelcolor", []() {
    int thisChannel;
    if ( server.hasArg( "channel" ) ) {
      thisChannel = server.arg( "channel" ).toInt();
      Serial.println(thisChannel);
      if ( thisChannel < 0 || thisChannel > NUMBER_OF_CHANNELS ) {
        server.send( 400,  textplainHEADER, "Invalid channel." );
        return;
      }

  server.on( "/api/getchannelnames", []()
  {
    String response;
    for ( byte channelNumber = 0; channelNumber < NUMBER_OF_CHANNELS; channelNumber++ )
    {
      response += channel[channelNumber].name + "\n";
    }
    server.setContentLength( response.length()  );
    server.send( 200, textplainHEADER, response );
