     return String(TABLE_LEITURA) + " failed to send:";
 }
 
-void inline updateMontionSensor() {
+void inline readMotionSensorAndSendToFirebase() {
     if (digitalRead(SENSORPIN) != motionSensorRead) {
         motionSensorRead = digitalRead(SENSORPIN);
         motion["state"] = String(motionSensorRead);

    String umid = String(dht.readHumidity());
    String cliente = CLIENT_EMAIL;
    String data = getEpoch();
    delay(1000);

    setLeitura(temperatura, umid, cliente, data);
    Serial.println("temp=" + temperatura + " umid=" + umid + " clnt=" + cliente + " dateTime=" + data);
}

void inline updateLeitura() {
    if (count > 1500) {
        readDataToSend();
        count = 0;
        Firebase.push(TABLE_LEITURA, leitura);
    }

    digitalWrite(LED_BUILTIN, !Firebase.getBool(String(DEVICE_PATH) + "light"));
}

//TODO verify wheter is this okay or not
void inline updateNtp() {
    WiFi.hostByName(ntpServerName, timeServer);
    setSyncProvider(getNtpTime);
    setSyncInterval(300);
}

void inline updateCountAndPrint() {
    delay(100);
    count++;
    Serial.println("/-----Count-------");
    Serial.println(count);
    Serial.println("------Count------/");
}

void loop() {
    updateNtp();
    readMotionSensorAndSendToFirebase();
    readLeituraAndSendToFirebase();
    updateLighAndFan();
    updateCountAndPrint();
}
