       {
         if(xbeeMode)
         {
-          Serial.println("Sending data...");
-          Serial2.print(currentDataSet[i]);
-          Serial2.print(" ");
-          if(i == (sizeof(currentDataSet)/sizeof(float) - 1)) Serial2.print("\r");
+          if(SDMode)
+          {
+            //SD with Xbee yet to be added, but should be much the same as below
+            Serial.println("SD with Xbee yet to be added, but should be much the same");
+          }
+          else
+          {
+            Serial.println("Sending data...");
+            Serial2.print(currentDataSet[i]);
+            Serial2.print(" ");
+            if(i == (sizeof(currentDataSet)/sizeof(float) - 1)) Serial2.print("\r");
+          }
         }
         else                                  //  If Xbees aren't being used UART1
         {                                     //  is used instead.
-          Serial.print(currentDataSet[i]);
-          Serial.print(" ");
-          if(i == (sizeof(currentDataSet)/sizeof(float) - 1)) Serial.print("\r");
-        }
-      }
-      delay(25);
+          if(SDMode)                    
+          {                                   //  If SD selected run SD routines
+            // SD Card Implementation
+            if(myFile) {
+              Serial.println("---- WRITING TO SD ---- "); // Testing if SD Card Works
+              myFile.print(currentDataSet[i]);           // Print dataset to SD Card
+              myFile.print(" ");                         // Formatting
+              if(i == (sizeof(currentDataSet)/sizeof(float) - 1)) myFile.print("\r");
+            }
+            
+            if (n==100)                                 // SD Card Close Loop
+            {                                           // Close to be Impl. by Plotter
+              Serial.println("---- CLOSE SD ----");     // Testing if SD Card Works
+              myFile.close();
+            }
+            
+            //Serial.print(currentDataSet[i]);           // Print dataset to Serial
+            //Serial.print(" ");
+            
+            if(i == (sizeof(currentDataSet)/sizeof(float) - 1)) Serial.print("\r");
+          }
+          else                                //  If SD is not selected, simply print 
+          {                                   //  data to UART1.
+            Serial.print(currentDataSet[i]);           // Print dataset to Serial
+            Serial.print(" ");
+            
+            if(i == (sizeof(currentDataSet)/sizeof(float) - 1)) Serial.print("\r");
+          }
+        }
+      }
+      delay(100);
       n++;                                   //  Increment loop counter
     }                                        
   }                                          

    int n=0;                                // Count loops around print routine
    int i=0;
    boolean transBegin = false;
    for(;;)
    {
      //~~~~~~~~~~~~~~~~~~~~~~~Create simulation data for now~~~~~~~~~~~~~~~~~~~~~~~~~~~


//===================================Library Includes====================================
#include <EEPROM.h>
#include <SD.h>
#include <SPI.h>
//=====================================Definitions=======================================
#define dataSetLength 6
#define EEPROM_TIMEBASE_ADDR 0

//===================================Program Settings====================================
boolean mockMode = false;                  //  Defines which mode of operation to use.
                                           //    - True denotes Mock Data Mode
                                           //    - False denotes Data Acquistion Mode

boolean sendConfigInfo = true;             //  This is an option to send an initial
                                           //  set of configuration settings, giving
                                           //  the plotting program more information
                                           //  on what data it is handling.

int configUpdateLimit = 10;                //  If config info strings are enabled,
                                           //  sets the maximum time elapsed before
                                           //  program should send an config update.
                                           
boolean xbeeMode = false;                  //  This condition determines whether Xbees
                                           //  are being used. Usually this would be
                                           //  true, except for testing without the
                                           //  Xbee.
                                           
boolean SDMode = false;                    //  Condition to execute optional SD
                                           //  functionality. This is provided for
                                           //  testing purposes where the SD might
                                           //  not be used.

int sigNum = 6;                            //  This allows quick changes to be made to
                                           //  the number of signals when in mock mode,
                                           //  which helps with testing transmission 
                                           //  capacity.
