   //Start software serial for GPS/GSM
   ss.begin(19200);  //Default serial port setting for the GPRS modem is 19200bps 8-N-1
   ss.print("\r");
-  delay(1000);                    //Wait for a second while the modem sends an "OK"
-  ss.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
   delay(1000);
-
-  ss.print("AT+CSCA=\"+9477000003\"\r");  //Setting for the SMS Message center number,  
-  delay(1000);                                  //uncomment only if required and replace with
-  //the message center number obtained from
-  //your GSM service provider.
-  //Note that when specifying a tring of characters
-  // " is entered as \"
-
-  ss.print("AT+CMGS=\"+94716494873\"\r");    //Start accepting the text for the message
-  //to be sent to the number specified.
-  //Replace this number with the target mobile number.
-  delay(1000);
-  ss.print("mws simduino setup\r");   //The text for the message
-  delay(1000);
-  ss.write(0x1A);  //Equivalent to sending Ctrl+Z 
-  delay(1000);
-
-  ss.print("AT+CMGD=\"1,4\"\r");    //Try to delete all sms in cache
-  delay(1000);
+  Serial.println(F("SMS part"));
+  do
+  {
+    ss.print("AT+CMGF=1\r");
+    Serial.println(sendData("AT+CMGF=0", 1000, DEBUG));
+       //Because we want to send the SMS in text mode
+  } while((String)"OK"!=sendData("AT+CMGF=1", 1000, DEBUG));
+  //Serial.println(sendData("AT+CSCA=\"+9477000003\"", 1000, DEBUG));  //Setting for the SMS Message center number,
+  //Note that when specifying a String of characters " is entered as \"
+  Serial.println(sendData("AT+CMGS=\"+94774496950\"", 1000, DEBUG));    //Start accepting the text for the message
+  //Serial.println(sendData("AT+CMGS=\"+94716494873\"", 1000, DEBUG));    //Start accepting the text for the message
+  Serial.println(sendData("\"mws simduino setup\"", 1000, DEBUG));   //The text for the message
+  Serial.println(sendData("0x1A", 1000, DEBUG));  //Equivalent to sending Ctrl+Z
+  //Serial.println(sendData("AT+CMGD=\"1,4\"\r", 1000, DEBUG));    //Try to delete all sms in cache
 
   Serial.print(F("lon,lat,altitude,sats,date,GMTtime,winddir"));
   Serial.print(F(",windspeedms,windgustms,windgustdir,windspdms_avg2m,winddir_avg2m,windgustms_10m,windgustdir_10m"));

  winddiravg[seconds_2m] = currentDirection;

  //Check to see if this is a gust for the minute
  if(currentSpeed > windgust_10m[minutes_10m])
  {
    windgust_10m[minutes_10m] = currentSpeed;
    windgustdirection_10m[minutes_10m] = currentDirection;
  }

  //Check to see if this is a gust for the day
  if(currentSpeed > windgustms)
  {
    windgustms = currentSpeed;
    windgustdir = currentDirection;
  }
  seconds += loopMSecond/1000;
  if(++seconds > 59) seconds = 0;
  if(++minutes > 59) minutes = 0;
  minutes += seconds/60;
  minutes_10m += seconds/60;
  if(++minutes_10m > 9){
    minutes_10m = 0;
    for (i=0;i<10;i++) windgust_10m[i] = 0;
  }
  rainHour[minutes] = 0; //Zero out this minute's rainfall amount
  windgust_10m[minutes_10m] = 0; //Zero out this minute's gust

  }

  //Calculate amount of rainfall for the last 60 minutes
  rainin = 0;
  for (int i = 0 ; i < 60 ; i++)
    rainin += rainHour[i];

  //Calc pressure
