 		} else if (command == COMMAND_CONNECT) {
 			connect();
 		} else if (command == COMMAND_IS_CONNECTED) {
-			send_data(COMMAND_IS_CONNECTED, String(WiFi.status() == WL_CONNECTED));
+			send_data(COMMAND_IS_CONNECTED, String(is_connected()));
 		} else if (command == COMMAND_DISCONNECT) {
 			disconnect();
 		} else if (command == COMMAND_GET_IP) {

	// The chip remembers its last ssid and password, so generally just running the server will make it reachable,
	// even without reconfiguring.
	server.begin();
}

void handle_request() {

		if (command == COMMAND_DEBUG){
			send_data(String("ssid"), ssid);
			send_data(String("password"), password);
			send_data(String("connected"), String(is_connected()));
			send_data(String("led_mode"), String(led_mode));
			send_data(String("baud rate"), String(baud_rate));
			send_data(String("ip"), format_ip(WiFi.localIP()));
