 // For more info, see "setupable.h".
 //custom::Setupable* setupables[] = {  };
 
-// Setup MicroSD card I/O. Trap the thread if no card is found.
-void setup_sd_card(void) {
-  if (!sd_card.begin()) {
-    Serial.println("ERROR: SD card could not be found.");
+// Setup the object. Trap the thread if no card is found.
+template <typename T> void setup_general(T obj, char* error_message, char* success_message) {
+  if (!obj.begin()) {
+    Serial.println(error_message);
+    Serial.println("PROGRAM WILL NOT PROCEED.");
     while (1) { /* Trap the thread. */ }
   }
-  Serial.println("SdCard successfully setup.");
+  Serial.println(success_message);
   Serial.println();
+}
+
+void setup_objects(void) {
+  setup_general<SdFatSdio>(sd_card, "ERROR: SD card could not be found or setup...",  "Success: SD card ready.");
+  setup_general<Adafruit_BME280>(bme, "Could not find a valid BME280 sensor...",      "Success: BME280 ready.");
 }
 
 void setup() {

#include <Wire.h>

// RCR headers
#include "Setupable.h"

SdFatSdio sd_card; // SD card manager
File file; // file manager

// To shorten RCR namespace, use namespace alias "custom".
namespace custom = rcr::level1payload;

    Serial.println("File could not be initialized."); 
  }
  else {
    file.println("Writing this to file.");
    file.close(); // Close when finished.
  }
}

//void printBmpData(void) {
//  Serial.print("Temperature = ");
//  Serial.print(bmp.temperature());
//  Serial.println(" °C");
//
//  Serial.print("Ambient pressure = ");
//  Serial.print(bmp.ambient_pressure());
//  Serial.println(" Pa");
//
//  Serial.print("Pressure altitude = ");
//  Serial.print(bmp.pressure_altitude());
//  Serial.println(" meters");
//  Serial.println();
//}

bool written = false;

void loop() {
  //printBmpData();
  Serial.println("in loop");
  if (!written) {
    write_to_sd();
    written = true;
