 */
   
 bool currently_active = true;
-  
+
+
+/*
+  Watchdog variables
+*/
+  
+long gprs_or_wifi_watchdog_timestamp = 0;
+int  gprs_or_wifi_watchdog_counter = 0;
+#define WATCHDOG_COUNTER_MAX	12
+
 /*
   GPRS flags that describe current state of communication
 */
   
-long gprs_or_wifi_watchdog_timestamp = 0;
-int  gprs_or_wifi_watchdog_counter = 0;
-
-
 #define	MAX_GPRS_READ_BUFFER	64
 
 #ifdef WIFI_NOT_CELL

  {  
    hardware_watchdog_timestamp = millis(); 
  }
  else if(gprs_or_wifi_watchdog_counter < 10)
  {
    hardware_watchdog_timestamp = millis();   
  }

    float closest = abs(temperature_history[BARO_HISTORY_LENGTH - 1] - average);
    temperature = temperature_history[BARO_HISTORY_LENGTH - 1];
    #ifdef BARO_DEBUG_ON
    debug_info("Temperature " + String(BARO_HISTORY_LENGTH) + ": ", temperature_history[BARO_HISTORY_LENGTH - 1]);
    #endif
    for(int_one = BARO_HISTORY_LENGTH - 2; int_one >= 0; int_one--)
    {
      #ifdef BARO_DEBUG_ON
      debug_info("Temperature " + String(int_one) + ": ", temperature_history[int_one]);
      #endif
      if(abs(temperature_history[int_one] - average) < closest)
      {
