diff --git a/autoplant/autoplant.ino b/autoplant/autoplant.ino
index 2d2b422..7f1ba12 100644
--- a/autoplant/autoplant.ino
+++ b/autoplant/autoplant.ino
@@ -3,8 +3,8 @@
 
 #include <ArduinoJson.h>
 #include <ESP8266WiFi.h>
-#include "../lib/pubsubclient/src/PubSubClient.h"
-#include "../lib/pubsubclient/src/PubSubClient.cpp"
+#include "./lib/pubsubclient/PubSubClient.h"
+#include "./lib/pubsubclient/PubSubClient.cpp"
 
 #include "settings.h"
 
@@ -30,14 +30,11 @@
 #define WATER_LEVEL_A	2
 #define WATER_LEVEL_B	4
 
+#define REFERENCE_VOLTAGE	3.3
 
 // Ref https://stackoverflow.com/a/523737/1460422
 #define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
 
-int soilPin = D3;
-
-float referenceVoltage = 3.3;
-
 WiFiClientSecure transport;
 PubSubClient mqtt;
 
@@ -54,17 +51,26 @@ float read_analog(int channel) {
 	digitalWrite(MULTIPLEX_PINC, b0);
 	
 	int rawValue = analogRead(ANALOG_PIN);
-	float parsedValue = ((float)rawValue) / 1024.0 * referenceVoltage;
+	float parsedValue = ((float)rawValue) / 1024.0 * REFERENCE_VOLTAGE;
 		
 	return parsedValue;
 }
 
-bool send_mqtt(StaticJsonDocument data) {
-	int length = measureJson(data);
-	char[length] payload;
-	serialiseJson(data, &payload, length);
+bool send_mqtt(char* id, char* sensor, float value) {
+	StaticJsonDocument<96> data;
 	
-	return rmqtt.publish("sensors/data", payload, length)
+	data["id"] = id;
+	data["sensor"] = sensor;
+	data["value"] = value;
+	
+	int length = measureJson(&data);
+	char* payload = new char[length]();
+	serializeJson(data, payload, length);
+	
+	bool result = mqtt.publish("sensors/data", payload, length);
+	delete[] payload;
+	
+	return result;
 }
 
 void setup() {
@@ -101,8 +107,11 @@ void setup() {
 	
 	Serial.print("MQTT: ");
 	mqtt.setClient(transport);
-	mqtt.setServer("autoplant" + String(random(0, 999999)));
-	if(!mqtt.connect(MQTT_USERNAME, MQTT_PASSWORD)) {
+	mqtt.setServer(MQTT_SERVER, MQTT_PORT);
+	if(!mqtt.connect(
+		("autoplant" + String(random(0, 999999))).c_str(),
+		MQTT_USERNAME, MQTT_PASSWORD)
+	) {
 		Serial.println("failed!");
 		while(true) delay(10000);
 	}
@@ -117,22 +126,43 @@ void loop() {
 	
 	StaticJsonDocument<96> data;
 	
-	data["id"] = "autoplant-a";
-	data["sensor"] = "soil";
-	data["value"] = soil_a;
-	if(!send_mqtt(data)) Serial.println("[mqtt] Failed to send message");
+	if(!send_mqtt(
+		"autoplant-a",
+		"soil",
+		soil_a
+	)) Serial.println("[mqtt] Failed to send message");
+	if(!send_mqtt(
+		"autoplant-a",
+		"water-level",
+		water_level_a
+	)) Serial.println("[mqtt] Failed to send message");
+	if(!send_mqtt(
+		"autoplant-b",
+		"soil",
+		soil_b
+	)) Serial.println("[mqtt] Failed to send message");
+	if(!send_mqtt(
+		"autoplant-b",
+		"water-level",
+		water_level_b
+	)) Serial.println("[mqtt] Failed to send message");
 	
-	data["sensor"] = "water-level";
-	data["value"] = water_level_a;
-	if(!send_mqtt(data)) Serial.println("[mqtt] Failed to send message");
-	
-	data["id"] = "autoplant-b";
-	data["value"] = water_level_a;
-	if(!send_mqtt(data)) Serial.println("[mqtt] Failed to send message");
-	
-	data["sensor"] = "soil";
-	data["value"] = soil_a;
-	if(!send_mqtt(data)) Serial.println("[mqtt] Failed to send message");
+	// data["id"] = "autoplant-a";
+	// data["sensor"] = "soil";
+	// data["value"] = soil_a;
+	// if(!send_mqtt(&data)) Serial.println("[mqtt] Failed to send message");
+	// 
+	// data["sensor"] = "water-level";
+	// data["value"] = water_level_a;
+	// if(!send_mqtt(&data)) Serial.println("[mqtt] Failed to send message");
+	// 
+	// data["id"] = "autoplant-b";
+	// data["value"] = water_level_a;
+	// if(!send_mqtt(&data)) Serial.println("[mqtt] Failed to send message");
+	// 
+	// data["sensor"] = "soil";
+	// data["value"] = soil_a;
+	// if(!send_mqtt(&data)) Serial.println("[mqtt] Failed to send message");
 	
 	Serial.print("SOIL_A\t");
 	Serial.println(soil_a);
diff --git a/autoplant/lib/pubsubclient/PubSubClient.cpp b/autoplant/lib/pubsubclient/PubSubClient.cpp
new file mode 120000
index 0000000..0fd1dd2
--- /dev/null
+++ b/autoplant/lib/pubsubclient/PubSubClient.cpp
@@ -0,0 +1 @@
+../../../lib/pubsubclient/src/PubSubClient.cpp
\ No newline at end of file
diff --git a/autoplant/lib/pubsubclient/PubSubClient.h b/autoplant/lib/pubsubclient/PubSubClient.h
new file mode 120000
index 0000000..09647f7
--- /dev/null
+++ b/autoplant/lib/pubsubclient/PubSubClient.h
@@ -0,0 +1 @@
+../../../lib/pubsubclient/src/PubSubClient.h
\ No newline at end of file
