diff --git a/cper-utils.c b/cper-utils.c
index 0eadf10..519349f 100644
--- a/cper-utils.c
+++ b/cper-utils.c
@@ -10,288 +10,301 @@
 #include "cper-utils.h"
 
 //The available severity types for CPER.
-const char* CPER_SEVERITY_TYPES[4] = {"Recoverable", "Fatal", "Corrected", "Informational"};
+const char *CPER_SEVERITY_TYPES[4] = { "Recoverable", "Fatal", "Corrected",
+				       "Informational" };
 
 //Converts the given generic CPER error status to JSON IR.
-json_object* cper_generic_error_status_to_ir(EFI_GENERIC_ERROR_STATUS* error_status)
+json_object *
+cper_generic_error_status_to_ir(EFI_GENERIC_ERROR_STATUS *error_status)
 {
-    json_object* error_status_ir = json_object_new_object();
+	json_object *error_status_ir = json_object_new_object();
 
-    //Error type.
-    json_object_object_add(error_status_ir, "errorType", integer_to_readable_pair_with_desc(error_status->Type, 18,
-        CPER_GENERIC_ERROR_TYPES_KEYS,
-        CPER_GENERIC_ERROR_TYPES_VALUES,
-        CPER_GENERIC_ERROR_TYPES_DESCRIPTIONS,
-        "Unknown (Reserved)"));
+	//Error type.
+	json_object_object_add(error_status_ir, "errorType",
+			       integer_to_readable_pair_with_desc(
+				       error_status->Type, 18,
+				       CPER_GENERIC_ERROR_TYPES_KEYS,
+				       CPER_GENERIC_ERROR_TYPES_VALUES,
+				       CPER_GENERIC_ERROR_TYPES_DESCRIPTIONS,
+				       "Unknown (Reserved)"));
 
-    //Boolean bit fields.
-    json_object_object_add(error_status_ir, "addressSignal", json_object_new_boolean(error_status->AddressSignal));
-    json_object_object_add(error_status_ir, "controlSignal", json_object_new_boolean(error_status->ControlSignal));
-    json_object_object_add(error_status_ir, "dataSignal", json_object_new_boolean(error_status->DataSignal));
-    json_object_object_add(error_status_ir, "detectedByResponder", json_object_new_boolean(error_status->DetectedByResponder));
-    json_object_object_add(error_status_ir, "detectedByRequester", json_object_new_boolean(error_status->DetectedByRequester));
-    json_object_object_add(error_status_ir, "firstError", json_object_new_boolean(error_status->FirstError));
-    json_object_object_add(error_status_ir, "overflowDroppedLogs", json_object_new_boolean(error_status->OverflowNotLogged));
-    
-    return error_status_ir;
+	//Boolean bit fields.
+	json_object_object_add(
+		error_status_ir, "addressSignal",
+		json_object_new_boolean(error_status->AddressSignal));
+	json_object_object_add(
+		error_status_ir, "controlSignal",
+		json_object_new_boolean(error_status->ControlSignal));
+	json_object_object_add(
+		error_status_ir, "dataSignal",
+		json_object_new_boolean(error_status->DataSignal));
+	json_object_object_add(
+		error_status_ir, "detectedByResponder",
+		json_object_new_boolean(error_status->DetectedByResponder));
+	json_object_object_add(
+		error_status_ir, "detectedByRequester",
+		json_object_new_boolean(error_status->DetectedByRequester));
+	json_object_object_add(
+		error_status_ir, "firstError",
+		json_object_new_boolean(error_status->FirstError));
+	json_object_object_add(
+		error_status_ir, "overflowDroppedLogs",
+		json_object_new_boolean(error_status->OverflowNotLogged));
+
+	return error_status_ir;
 }
 
 //Converts the given CPER-JSON generic error status into a CPER structure.
-void ir_generic_error_status_to_cper(json_object* error_status, EFI_GENERIC_ERROR_STATUS* error_status_cper)
+void ir_generic_error_status_to_cper(
+	json_object *error_status, EFI_GENERIC_ERROR_STATUS *error_status_cper)
 {
-    error_status_cper->Type = readable_pair_to_integer(json_object_object_get(error_status, "errorType"));
-    error_status_cper->AddressSignal = json_object_get_boolean(json_object_object_get(error_status, "addressSignal"));
-    error_status_cper->ControlSignal = json_object_get_boolean(json_object_object_get(error_status, "controlSignal"));
-    error_status_cper->DataSignal = json_object_get_boolean(json_object_object_get(error_status, "dataSignal"));
-    error_status_cper->DetectedByResponder = json_object_get_boolean(json_object_object_get(error_status, "detectedByResponder"));
-    error_status_cper->DetectedByRequester = json_object_get_boolean(json_object_object_get(error_status, "detectedByRequester"));
-    error_status_cper->FirstError = json_object_get_boolean(json_object_object_get(error_status, "firstError"));
-    error_status_cper->OverflowNotLogged = json_object_get_boolean(json_object_object_get(error_status, "overflowDroppedLogs"));
+	error_status_cper->Type = readable_pair_to_integer(
+		json_object_object_get(error_status, "errorType"));
+	error_status_cper->AddressSignal = json_object_get_boolean(
+		json_object_object_get(error_status, "addressSignal"));
+	error_status_cper->ControlSignal = json_object_get_boolean(
+		json_object_object_get(error_status, "controlSignal"));
+	error_status_cper->DataSignal = json_object_get_boolean(
+		json_object_object_get(error_status, "dataSignal"));
+	error_status_cper->DetectedByResponder = json_object_get_boolean(
+		json_object_object_get(error_status, "detectedByResponder"));
+	error_status_cper->DetectedByRequester = json_object_get_boolean(
+		json_object_object_get(error_status, "detectedByRequester"));
+	error_status_cper->FirstError = json_object_get_boolean(
+		json_object_object_get(error_status, "firstError"));
+	error_status_cper->OverflowNotLogged = json_object_get_boolean(
+		json_object_object_get(error_status, "overflowDroppedLogs"));
 }
 
 //Converts a single uniform struct of UINT64s into intermediate JSON IR format, given names for each field in byte order.
-json_object* uniform_struct64_to_ir(UINT64* start, int len, const char* names[])
+json_object *uniform_struct64_to_ir(UINT64 *start, int len, const char *names[])
 {
-    json_object* result = json_object_new_object();
+	json_object *result = json_object_new_object();
 
-    UINT64* cur = start;
-    for (int i=0; i<len; i++)
-    {
-        json_object_object_add(result, names[i], json_object_new_uint64(*cur));
-        cur++;
-    }
+	UINT64 *cur = start;
+	for (int i = 0; i < len; i++) {
+		json_object_object_add(result, names[i],
+				       json_object_new_uint64(*cur));
+		cur++;
+	}
 
-    return result;
+	return result;
 }
 
 //Converts a single uniform struct of UINT32s into intermediate JSON IR format, given names for each field in byte order.
-json_object* uniform_struct_to_ir(UINT32* start, int len, const char* names[])
+json_object *uniform_struct_to_ir(UINT32 *start, int len, const char *names[])
 {
-    json_object* result = json_object_new_object();
+	json_object *result = json_object_new_object();
 
-    UINT32* cur = start;
-    for (int i=0; i<len; i++)
-    {
-        json_object_object_add(result, names[i], json_object_new_uint64(*cur));
-        cur++;
-    }
+	UINT32 *cur = start;
+	for (int i = 0; i < len; i++) {
+		json_object_object_add(result, names[i],
+				       json_object_new_uint64(*cur));
+		cur++;
+	}
 
-    return result;
+	return result;
 }
 
 //Converts a single object containing UINT32s into a uniform struct.
-void ir_to_uniform_struct64(json_object* ir, UINT64* start, int len, const char* names[])
+void ir_to_uniform_struct64(json_object *ir, UINT64 *start, int len,
+			    const char *names[])
 {
-    UINT64* cur = start;
-    for (int i=0; i<len; i++)
-    {
-        *cur = json_object_get_uint64(json_object_object_get(ir, names[i]));
-        cur++;
-    }
+	UINT64 *cur = start;
+	for (int i = 0; i < len; i++) {
+		*cur = json_object_get_uint64(
+			json_object_object_get(ir, names[i]));
+		cur++;
+	}
 }
 
 //Converts a single object containing UINT32s into a uniform struct.
-void ir_to_uniform_struct(json_object* ir, UINT32* start, int len, const char* names[])
+void ir_to_uniform_struct(json_object *ir, UINT32 *start, int len,
+			  const char *names[])
 {
-    UINT32* cur = start;
-    for (int i=0; i<len; i++)
-    {
-        *cur = (UINT32)json_object_get_uint64(json_object_object_get(ir, names[i]));
-        cur++;
-    }
+	UINT32 *cur = start;
+	for (int i = 0; i < len; i++) {
+		*cur = (UINT32)json_object_get_uint64(
+			json_object_object_get(ir, names[i]));
+		cur++;
+	}
 }
 
 //Converts a single integer value to an object containing a value, and a readable name if possible.
-json_object* integer_to_readable_pair(UINT64 value, int len, int keys[], const char* values[], const char* default_value)
+json_object *integer_to_readable_pair(UINT64 value, int len, int keys[],
+				      const char *values[],
+				      const char *default_value)
 {
-    json_object* result = json_object_new_object();
-    json_object_object_add(result, "value", json_object_new_uint64(value));
+	json_object *result = json_object_new_object();
+	json_object_object_add(result, "value", json_object_new_uint64(value));
 
-    //Search for human readable name, add.
-    const char* name = default_value;
-    for (int i=0; i<len; i++)
-    {
-        if (keys[i] == value)
-            name = values[i];
-    }
+	//Search for human readable name, add.
+	const char *name = default_value;
+	for (int i = 0; i < len; i++) {
+		if (keys[i] == value)
+			name = values[i];
+	}
 
-    json_object_object_add(result, "name", json_object_new_string(name));
-    return result;
+	json_object_object_add(result, "name", json_object_new_string(name));
+	return result;
 }
 
 //Converts a single integer value to an object containing a value, readable name and description if possible.
-json_object* integer_to_readable_pair_with_desc(int value, int len, int keys[], const char* values[], 
-    const char* descriptions[], const char* default_value) 
+json_object *integer_to_readable_pair_with_desc(int value, int len, int keys[],
+						const char *values[],
+						const char *descriptions[],
+						const char *default_value)
 {
-    json_object* result = json_object_new_object();
-    json_object_object_add(result, "value", json_object_new_int(value));
+	json_object *result = json_object_new_object();
+	json_object_object_add(result, "value", json_object_new_int(value));
 
-    //Search for human readable name, add.
-    const char* name = default_value;
-    for (int i=0; i<len; i++)
-    {
-        if (keys[i] == value) 
-        {
-            name = values[i];
-            json_object_object_add(result, "description", json_object_new_string(descriptions[i]));
-        }
-    }
+	//Search for human readable name, add.
+	const char *name = default_value;
+	for (int i = 0; i < len; i++) {
+		if (keys[i] == value) {
+			name = values[i];
+			json_object_object_add(
+				result, "description",
+				json_object_new_string(descriptions[i]));
+		}
+	}
 
-    json_object_object_add(result, "name", json_object_new_string(name));
-    return result;
+	json_object_object_add(result, "name", json_object_new_string(name));
+	return result;
 }
 
 //Returns a single UINT64 value from the given readable pair object.
 //Assumes the integer value is held in the "value" field.
-UINT64 readable_pair_to_integer(json_object* pair)
+UINT64 readable_pair_to_integer(json_object *pair)
 {
-    return json_object_get_uint64(json_object_object_get(pair, "value"));
+	return json_object_get_uint64(json_object_object_get(pair, "value"));
 }
 
 //Converts the given 64 bit bitfield to IR, assuming bit 0 starts on the left.
-json_object* bitfield_to_ir(UINT64 bitfield, int num_fields, const char* names[])
+json_object *bitfield_to_ir(UINT64 bitfield, int num_fields,
+			    const char *names[])
 {
-    json_object* result = json_object_new_object();
-    for (int i=0; i<num_fields; i++)
-    {
-        json_object_object_add(result, names[i], json_object_new_boolean((bitfield >> i) & 0b1));
-    }
+	json_object *result = json_object_new_object();
+	for (int i = 0; i < num_fields; i++) {
+		json_object_object_add(result, names[i],
+				       json_object_new_boolean((bitfield >> i) &
+							       0b1));
+	}
 
-    return result;
+	return result;
 }
 
 //Converts the given IR bitfield into a standard UINT64 bitfield, with fields beginning from bit 0.
-UINT64 ir_to_bitfield(json_object* ir, int num_fields, const char* names[])
+UINT64 ir_to_bitfield(json_object *ir, int num_fields, const char *names[])
 {
-    UINT64 result = 0x0;
-    for (int i=0; i<num_fields; i++)
-    {
-        if (json_object_get_boolean(json_object_object_get(ir, names[i])))
-            result |= (0x1 << i);
-    }
+	UINT64 result = 0x0;
+	for (int i = 0; i < num_fields; i++) {
+		if (json_object_get_boolean(
+			    json_object_object_get(ir, names[i])))
+			result |= (0x1 << i);
+	}
 
-    return result;
+	return result;
 }
 
 //Converts the given UINT64 array into a JSON IR array, given the length.
-json_object* uint64_array_to_ir_array(UINT64* array, int len)
+json_object *uint64_array_to_ir_array(UINT64 *array, int len)
 {
-    json_object* array_ir = json_object_new_array();
-    for (int i=0; i<len; i++)
-        json_object_array_add(array_ir, json_object_new_uint64(array[i]));
-    return array_ir;
+	json_object *array_ir = json_object_new_array();
+	for (int i = 0; i < len; i++)
+		json_object_array_add(array_ir,
+				      json_object_new_uint64(array[i]));
+	return array_ir;
 }
 
 //Converts a single UINT16 revision number into JSON IR representation.
-json_object* revision_to_ir(UINT16 revision)
+json_object *revision_to_ir(UINT16 revision)
 {
-    json_object* revision_info = json_object_new_object();
-    json_object_object_add(revision_info, "major", json_object_new_int(revision >> 8));
-    json_object_object_add(revision_info, "minor", json_object_new_int(revision & 0xFF));
-    return revision_info;
+	json_object *revision_info = json_object_new_object();
+	json_object_object_add(revision_info, "major",
+			       json_object_new_int(revision >> 8));
+	json_object_object_add(revision_info, "minor",
+			       json_object_new_int(revision & 0xFF));
+	return revision_info;
 }
 
 //Returns the appropriate string for the given integer severity.
-const char* severity_to_string(UINT32 severity)
+const char *severity_to_string(UINT32 severity)
 {
-    return severity < 4 ? CPER_SEVERITY_TYPES[severity] : "Unknown";
+	return severity < 4 ? CPER_SEVERITY_TYPES[severity] : "Unknown";
 }
 
 //Converts a single EFI timestamp to string, at the given output.
 //Output must be at least TIMESTAMP_LENGTH bytes long.
-void timestamp_to_string(char* out, EFI_ERROR_TIME_STAMP* timestamp)
+void timestamp_to_string(char *out, EFI_ERROR_TIME_STAMP *timestamp)
 {
-    sprintf(out, "%02hhu%02hhu-%02hhu-%02hhuT%02hhu:%02hhu:%02hhu.000", 
-            bcd_to_int(timestamp->Century) % 100, //Cannot go to three digits.
-            bcd_to_int(timestamp->Year) % 100, //Cannot go to three digits.
-            bcd_to_int(timestamp->Month),
-            bcd_to_int(timestamp->Day),
-            bcd_to_int(timestamp->Hours),
-            bcd_to_int(timestamp->Minutes),
-            bcd_to_int(timestamp->Seconds));
+	sprintf(out, "%02hhu%02hhu-%02hhu-%02hhuT%02hhu:%02hhu:%02hhu.000",
+		bcd_to_int(timestamp->Century) %
+			100, //Cannot go to three digits.
+		bcd_to_int(timestamp->Year) % 100, //Cannot go to three digits.
+		bcd_to_int(timestamp->Month), bcd_to_int(timestamp->Day),
+		bcd_to_int(timestamp->Hours), bcd_to_int(timestamp->Minutes),
+		bcd_to_int(timestamp->Seconds));
 }
 
 //Converts a single timestamp string to an EFI timestamp.
-void string_to_timestamp(EFI_ERROR_TIME_STAMP* out, const char* timestamp)
+void string_to_timestamp(EFI_ERROR_TIME_STAMP *out, const char *timestamp)
 {
-    //Ignore invalid timestamps.
-    if (timestamp == NULL)
-        return;
+	//Ignore invalid timestamps.
+	if (timestamp == NULL)
+		return;
 
-    sscanf(timestamp, "%2hhu%2hhu-%hhu-%hhuT%hhu:%hhu:%hhu.000", 
-            &out->Century,
-            &out->Year,
-            &out->Month,
-            &out->Day,
-            &out->Hours,
-            &out->Minutes,
-            &out->Seconds);
+	sscanf(timestamp, "%2hhu%2hhu-%hhu-%hhuT%hhu:%hhu:%hhu.000",
+	       &out->Century, &out->Year, &out->Month, &out->Day, &out->Hours,
+	       &out->Minutes, &out->Seconds);
 
-    //Convert back to BCD.
-    out->Century = int_to_bcd(out->Century);
-    out->Year = int_to_bcd(out->Year);
-    out->Month = int_to_bcd(out->Month);
-    out->Day = int_to_bcd(out->Day);
-    out->Hours = int_to_bcd(out->Hours);
-    out->Minutes = int_to_bcd(out->Minutes);
-    out->Seconds = int_to_bcd(out->Seconds);
+	//Convert back to BCD.
+	out->Century = int_to_bcd(out->Century);
+	out->Year = int_to_bcd(out->Year);
+	out->Month = int_to_bcd(out->Month);
+	out->Day = int_to_bcd(out->Day);
+	out->Hours = int_to_bcd(out->Hours);
+	out->Minutes = int_to_bcd(out->Minutes);
+	out->Seconds = int_to_bcd(out->Seconds);
 }
 
 //Helper function to convert an EDK EFI GUID into a string for intermediate use.
-void guid_to_string(char* out, EFI_GUID* guid)
+void guid_to_string(char *out, EFI_GUID *guid)
 {
-    sprintf(out, "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x", 
-        guid->Data1, 
-        guid->Data2, 
-        guid->Data3,
-        guid->Data4[0],
-        guid->Data4[1],
-        guid->Data4[2],
-        guid->Data4[3],
-        guid->Data4[4],
-        guid->Data4[5],
-        guid->Data4[6],
-        guid->Data4[7]);
+	sprintf(out, "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x",
+		guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
+		guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
+		guid->Data4[5], guid->Data4[6], guid->Data4[7]);
 }
 
 //Helper function to convert a string into an EDK EFI GUID.
-void string_to_guid(EFI_GUID* out, const char* guid)
+void string_to_guid(EFI_GUID *out, const char *guid)
 {
-    //Ignore invalid GUIDs.
-    if (guid == NULL)
-        return;
+	//Ignore invalid GUIDs.
+	if (guid == NULL)
+		return;
 
-    sscanf(guid, "%08x-%04hx-%04hx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx", 
-        &out->Data1, 
-        &out->Data2, 
-        &out->Data3,
-        out->Data4,
-        out->Data4 + 1,
-        out->Data4 + 2,
-        out->Data4 + 3,
-        out->Data4 + 4,
-        out->Data4 + 5,
-        out->Data4 + 6,
-        out->Data4 + 7);
+	sscanf(guid,
+	       "%08x-%04hx-%04hx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
+	       &out->Data1, &out->Data2, &out->Data3, out->Data4,
+	       out->Data4 + 1, out->Data4 + 2, out->Data4 + 3, out->Data4 + 4,
+	       out->Data4 + 5, out->Data4 + 6, out->Data4 + 7);
 }
 
 //Returns one if two EFI GUIDs are equal, zero otherwise.
-int guid_equal(EFI_GUID* a, EFI_GUID* b)
+int guid_equal(EFI_GUID *a, EFI_GUID *b)
 {
-    //Check top base 3 components.
-    if (a->Data1 != b->Data1
-        || a->Data2 != b->Data2
-        || a->Data3 != b->Data3) 
-    {
-        return 0;
-    }
+	//Check top base 3 components.
+	if (a->Data1 != b->Data1 || a->Data2 != b->Data2 ||
+	    a->Data3 != b->Data3) {
+		return 0;
+	}
 
-    //Check Data4 array for equality.
-    for (int i=0; i<8; i++)
-    {
-        if (a->Data4[i] != b->Data4[i])
-            return 0;
-    }
+	//Check Data4 array for equality.
+	for (int i = 0; i < 8; i++) {
+		if (a->Data4[i] != b->Data4[i])
+			return 0;
+	}
 
-    return 1;
+	return 1;
 }
\ No newline at end of file
