 
 void loop() {
 
-  if(masterEnableFlag) //Only save/buffer data if we're actively sensing data
-  {
-/* Get a new sensor event */ 
+  /* Get a new sensor event */
   sensors_event_t mainEvent;
   gyro.getEvent(&mainEvent);
   accel.getEvent(&mainEvent); // Assume Z-axis is vertical for accel/gyro?
   bmp.getEvent(&mainEvent);
-    
-  Record_Data(mainEvent);//Save sensor data (accel, baro, time, GPS) to the SD card
-  BufferUpdate(mainEvent);
-  }
-  
-  if(gpsOnFlag)
-  char c = GPS.read(); //Must call GPS.read() at some point for data transmission to occur
-
-  if(startTime != 0)
-  flightTime = millis() - startTime; //Timer backup variable
-  
-  if(radioWorkingFlag) {
-  Radio_Transmit(); //Transmit/receive select data
-  }
- 
-switch(flightState) { //Switch statement for entire rocket flight
-  /* 
-   * Switch conditions have been greatly improved (running averages with multiple sensors)
-   * However, I do want to look at the Accel conditions again, maybe mess with the time as well?
-   * Getting this part right is really, really important
-   */
-
-case waiting:
-if(accelAverage > LIFTOFF_ACCEL_THRESHOLD && masterEnableFlag)
-{
-  flightState = launched;
-  startTime = millis();
+
+  if (masterEnableFlag) //Only save/buffer data if we're actively sensing data
+  {
+    Record_Data(mainEvent);//Save sensor data (accel, baro, time, GPS) to the SD card
+    BufferUpdate(mainEvent);
+  }
+
+  if (gpsOnFlag)
+    char c = GPS.read(); //Must call GPS.read() at some point for data transmission to occur
+
+  if (startTime != 0)
+    flightTime = millis() - startTime; //Variable tracking post-launch time for backup flight staging
+
+  if (radioWorkingFlag)
+    Radio_Transmit(); //Transmit/receive select data
+
+
+  switch (flightState) { //Switch statement for entire rocket flight
+    /*
+       Switch conditions have been greatly improved (running averages with multiple sensors)
+       However, I do want to look at the Accel conditions again, maybe mess with the time as well?
+       Getting this part right is really, really important
+    */
+
+    case waiting:
+      if (accelAverage > LIFTOFF_ACCEL_THRESHOLD && masterEnableFlag)
+      {
+        flightState = launched;
+        startTime = millis();
+      }
+      break;
+
+
+    case launched:
+      if (abs(accelAverage) < BURNOUT_ACCEL_THRESHOLD || baroAverage > BURNOUT_BARO_THRESHOLD || flightTime > BURNOUT_TIME_THRESHOLD)
+      {
+        flightState = burnout;
+      }
+      break;
+
+
+    case burnout:
+
+      Roll_Control(mainEvent);
+
+      if (accelAverage > APOGEE_ACCEL_THRESHOLD || flightTime > APOGEE_TIME_THRESHOLD) //Add a baro test here?
+      {
+        flightState = falling;
+      }
+      break;
+
+
+    case falling:
+      if (baroAverage < LANDED_BARO_THRESHOLD)
+      {
+        flightState = landed;
+      }
+
+      if (baroAverage < GPS_BARO_THRESHOLD) //Enable GPS if we're low enough
+      {
+        GPS.begin(9600); //Initialize GPS; define output set and data rate
+        GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
+        GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
+        gpsOnFlag = true;
+      }
+
+      break;
+
+    case landed:
+
+      break;
+  }
 }
-break;
-
-
-case launched:
-if(abs(accelAverage) < BURNOUT_ACCEL_THRESHOLD || baroAverage > BURNOUT_BARO_THRESHOLD || flightTime > BURNOUT_TIME_THRESHOLD)
-{
-  flightState = burnout;
-}
-break;
-
-
-case burnout:
-Roll_Control(mainEvent);
-if(accelAverage > APOGEE_ACCEL_THRESHOLD || flightTime > APOGEE_TIME_THRESHOLD) //Add a baro test here?
-{
-  flightState = falling;
-}
-break;
-
-
-case falling:
-if(baroAverage < LANDED_BARO_THRESHOLD)
-{
-  flightState = landed;
-}
-
-if(baroAverage < GPS_BARO_THRESHOLD) //Enable GPS if we're low enough
-{
-  GPS.begin(9600); //Initialize GPS; define output set and data rate
-  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
-  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
-  gpsOnFlag = true;
-}
-
-break;
-
-case landed:
-
-break;
-  }
-}
 
 void Roll_Control(sensors_event_t event) {
 
+<<<<<<< Updated upstream
   if(!startRollFlag) { //For roll initialization, cant fins in the direction of current roll
     digitalWrite(inputA, LOW);
     servoHomeFlag = false;

   *  Etc., etc.
 * 
 */

#include <Wire.h>
#include <SPI.h>

  digitalWrite(RFM95_RST, HIGH);
  delay(10);

  if (!rf95.init()) { //Confirm radio was initialized properly and set frequency; note if a failure occurs
    radioWorkingFlag = false;
  }
  if (!rf95.setFrequency(RF95_FREQ)) {
    radioWorkingFlag = false;
  }
  rf95.setTxPower(23, false); //Set transmitter power to maximum (23 dBm); not sure what the bool value is for but all the examples used it
