Partial reformat to kernel code style.
diff --git a/sections/cper-section-arm.c b/sections/cper-section-arm.c
index 73e63ed..cdafd34 100644
--- a/sections/cper-section-arm.c
+++ b/sections/cper-section-arm.c
@@ -13,686 +13,887 @@
 #include "cper-section-arm.h"
 
 //Private pre-definitions.
-json_object* cper_arm_error_info_to_ir(EFI_ARM_ERROR_INFORMATION_ENTRY* error_info);
-json_object* cper_arm_processor_context_to_ir(EFI_ARM_CONTEXT_INFORMATION_HEADER* header, void** cur_pos);
-json_object* cper_arm_cache_tlb_error_to_ir(EFI_ARM_CACHE_ERROR_STRUCTURE* cache_tlb_error, EFI_ARM_ERROR_INFORMATION_ENTRY* error_info);
-json_object* cper_arm_bus_error_to_ir(EFI_ARM_BUS_ERROR_STRUCTURE* bus_error);
-json_object* cper_arm_misc_register_array_to_ir(EFI_ARM_MISC_CONTEXT_REGISTER* misc_register);
-void ir_arm_error_info_to_cper(json_object* error_info, FILE* out);
-void ir_arm_context_info_to_cper(json_object* context_info, FILE* out);
-void ir_arm_error_cache_tlb_info_to_cper(json_object* error_information, EFI_ARM_CACHE_ERROR_STRUCTURE* error_info_cper);
-void ir_arm_error_bus_info_to_cper(json_object* error_information, EFI_ARM_BUS_ERROR_STRUCTURE* error_info_cper);
-void ir_arm_aarch32_gpr_to_cper(json_object* registers, FILE* out);
-void ir_arm_aarch32_el1_to_cper(json_object* registers, FILE* out);
-void ir_arm_aarch32_el2_to_cper(json_object* registers, FILE* out);
-void ir_arm_aarch32_secure_to_cper(json_object* registers, FILE* out);
-void ir_arm_aarch64_gpr_to_cper(json_object* registers, FILE* out);
-void ir_arm_aarch64_el1_to_cper(json_object* registers, FILE* out);
-void ir_arm_aarch64_el2_to_cper(json_object* registers, FILE* out);
-void ir_arm_aarch64_el3_to_cper(json_object* registers, FILE* out);
-void ir_arm_misc_registers_to_cper(json_object* registers, FILE* out);
-void ir_arm_unknown_register_to_cper(json_object* registers, EFI_ARM_CONTEXT_INFORMATION_HEADER* header, FILE* out);
+json_object *
+cper_arm_error_info_to_ir(EFI_ARM_ERROR_INFORMATION_ENTRY *error_info);
+json_object *
+cper_arm_processor_context_to_ir(EFI_ARM_CONTEXT_INFORMATION_HEADER *header,
+				 void **cur_pos);
+json_object *
+cper_arm_cache_tlb_error_to_ir(EFI_ARM_CACHE_ERROR_STRUCTURE *cache_tlb_error,
+			       EFI_ARM_ERROR_INFORMATION_ENTRY *error_info);
+json_object *cper_arm_bus_error_to_ir(EFI_ARM_BUS_ERROR_STRUCTURE *bus_error);
+json_object *cper_arm_misc_register_array_to_ir(
+	EFI_ARM_MISC_CONTEXT_REGISTER *misc_register);
+void ir_arm_error_info_to_cper(json_object *error_info, FILE *out);
+void ir_arm_context_info_to_cper(json_object *context_info, FILE *out);
+void ir_arm_error_cache_tlb_info_to_cper(
+	json_object *error_information,
+	EFI_ARM_CACHE_ERROR_STRUCTURE *error_info_cper);
+void ir_arm_error_bus_info_to_cper(json_object *error_information,
+				   EFI_ARM_BUS_ERROR_STRUCTURE *error_info_cper);
+void ir_arm_aarch32_gpr_to_cper(json_object *registers, FILE *out);
+void ir_arm_aarch32_el1_to_cper(json_object *registers, FILE *out);
+void ir_arm_aarch32_el2_to_cper(json_object *registers, FILE *out);
+void ir_arm_aarch32_secure_to_cper(json_object *registers, FILE *out);
+void ir_arm_aarch64_gpr_to_cper(json_object *registers, FILE *out);
+void ir_arm_aarch64_el1_to_cper(json_object *registers, FILE *out);
+void ir_arm_aarch64_el2_to_cper(json_object *registers, FILE *out);
+void ir_arm_aarch64_el3_to_cper(json_object *registers, FILE *out);
+void ir_arm_misc_registers_to_cper(json_object *registers, FILE *out);
+void ir_arm_unknown_register_to_cper(json_object *registers,
+				     EFI_ARM_CONTEXT_INFORMATION_HEADER *header,
+				     FILE *out);
 
 //Converts the given processor-generic CPER section into JSON IR.
-json_object* cper_section_arm_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *cper_section_arm_to_ir(void *section,
+				    EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_ARM_ERROR_RECORD* record = (EFI_ARM_ERROR_RECORD*)section;
-    json_object* section_ir = json_object_new_object();
-    
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(record->ValidFields, 4, ARM_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	EFI_ARM_ERROR_RECORD *record = (EFI_ARM_ERROR_RECORD *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Number of error info and context info structures, and length.
-    json_object_object_add(section_ir, "errorInfoNum", json_object_new_int(record->ErrInfoNum));
-    json_object_object_add(section_ir, "contextInfoNum", json_object_new_int(record->ContextInfoNum));
-    json_object_object_add(section_ir, "sectionLength", json_object_new_uint64(record->SectionLength));
+	//Validation bits.
+	json_object *validation = bitfield_to_ir(
+		record->ValidFields, 4, ARM_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Error affinity.
-    json_object* error_affinity = json_object_new_object();
-    json_object_object_add(error_affinity, "value", json_object_new_int(record->ErrorAffinityLevel));
-    json_object_object_add(error_affinity, "type", 
-        json_object_new_string(record->ErrorAffinityLevel < 4 ? "Vendor Defined" : "Reserved"));
-    json_object_object_add(section_ir, "errorAffinity", error_affinity);
+	//Number of error info and context info structures, and length.
+	json_object_object_add(section_ir, "errorInfoNum",
+			       json_object_new_int(record->ErrInfoNum));
+	json_object_object_add(section_ir, "contextInfoNum",
+			       json_object_new_int(record->ContextInfoNum));
+	json_object_object_add(section_ir, "sectionLength",
+			       json_object_new_uint64(record->SectionLength));
 
-    //Processor ID (MPIDR_EL1) and chip ID (MIDR_EL1).
-    json_object_object_add(section_ir, "mpidrEl1", json_object_new_uint64(record->MPIDR_EL1));
-    json_object_object_add(section_ir, "midrEl1", json_object_new_uint64(record->MIDR_EL1));
+	//Error affinity.
+	json_object *error_affinity = json_object_new_object();
+	json_object_object_add(error_affinity, "value",
+			       json_object_new_int(record->ErrorAffinityLevel));
+	json_object_object_add(
+		error_affinity, "type",
+		json_object_new_string(record->ErrorAffinityLevel < 4 ?
+						     "Vendor Defined" :
+						     "Reserved"));
+	json_object_object_add(section_ir, "errorAffinity", error_affinity);
 
-    //Whether the processor is running, and the state of it if so.
-    json_object_object_add(section_ir, "running", json_object_new_boolean(record->RunningState & 0b1));
-    if (!(record->RunningState >> 31))
-    {
-        //Bit 32 of running state is on, so PSCI state information is included.
-        //This can't be made human readable, as it is unknown whether this will be the pre-PSCI 1.0 format
-        //or the newer Extended StateID format.
-        json_object_object_add(section_ir, "psciState", json_object_new_uint64(record->PsciState));
-    }
+	//Processor ID (MPIDR_EL1) and chip ID (MIDR_EL1).
+	json_object_object_add(section_ir, "mpidrEl1",
+			       json_object_new_uint64(record->MPIDR_EL1));
+	json_object_object_add(section_ir, "midrEl1",
+			       json_object_new_uint64(record->MIDR_EL1));
 
-    //Processor error structures.
-    json_object* error_info_array = json_object_new_array();
-    EFI_ARM_ERROR_INFORMATION_ENTRY* cur_error = (EFI_ARM_ERROR_INFORMATION_ENTRY*)(record + 1);
-    for (int i=0; i<record->ErrInfoNum; i++) 
-    {
-        json_object_array_add(error_info_array, cper_arm_error_info_to_ir(cur_error));
-        cur_error++;
-    }
-    json_object_object_add(section_ir, "errorInfo", error_info_array);
+	//Whether the processor is running, and the state of it if so.
+	json_object_object_add(section_ir, "running",
+			       json_object_new_boolean(record->RunningState &
+						       0b1));
+	if (!(record->RunningState >> 31)) {
+		//Bit 32 of running state is on, so PSCI state information is included.
+		//This can't be made human readable, as it is unknown whether this will be the pre-PSCI 1.0 format
+		//or the newer Extended StateID format.
+		json_object_object_add(
+			section_ir, "psciState",
+			json_object_new_uint64(record->PsciState));
+	}
 
-    //Processor context structures.
-    //The current position is moved within the processing, as it is a dynamic size structure.
-    void* cur_pos = (void*)cur_error;
-    json_object* context_info_array = json_object_new_array();
-    for (int i=0; i<record->ContextInfoNum; i++)
-    {
-        EFI_ARM_CONTEXT_INFORMATION_HEADER* header = (EFI_ARM_CONTEXT_INFORMATION_HEADER*)cur_pos;
-        json_object* processor_context = cper_arm_processor_context_to_ir(header, &cur_pos);
-        json_object_array_add(context_info_array, processor_context);
-    }
-    json_object_object_add(section_ir, "contextInfo", context_info_array);
+	//Processor error structures.
+	json_object *error_info_array = json_object_new_array();
+	EFI_ARM_ERROR_INFORMATION_ENTRY *cur_error =
+		(EFI_ARM_ERROR_INFORMATION_ENTRY *)(record + 1);
+	for (int i = 0; i < record->ErrInfoNum; i++) {
+		json_object_array_add(error_info_array,
+				      cper_arm_error_info_to_ir(cur_error));
+		cur_error++;
+	}
+	json_object_object_add(section_ir, "errorInfo", error_info_array);
 
-    //Is there any vendor-specific information following?
-    if (cur_pos < section + record->SectionLength)
-    {
-        json_object* vendor_specific = json_object_new_object();
-        char* encoded = b64_encode((unsigned char*)cur_pos, section + record->SectionLength - cur_pos);
-        json_object_object_add(vendor_specific, "data", json_object_new_string(encoded));
-        free(encoded);
+	//Processor context structures.
+	//The current position is moved within the processing, as it is a dynamic size structure.
+	void *cur_pos = (void *)cur_error;
+	json_object *context_info_array = json_object_new_array();
+	for (int i = 0; i < record->ContextInfoNum; i++) {
+		EFI_ARM_CONTEXT_INFORMATION_HEADER *header =
+			(EFI_ARM_CONTEXT_INFORMATION_HEADER *)cur_pos;
+		json_object *processor_context =
+			cper_arm_processor_context_to_ir(header, &cur_pos);
+		json_object_array_add(context_info_array, processor_context);
+	}
+	json_object_object_add(section_ir, "contextInfo", context_info_array);
 
-        json_object_object_add(section_ir, "vendorSpecificInfo", vendor_specific);
-    }
+	//Is there any vendor-specific information following?
+	if (cur_pos < section + record->SectionLength) {
+		json_object *vendor_specific = json_object_new_object();
+		char *encoded =
+			b64_encode((unsigned char *)cur_pos,
+				   section + record->SectionLength - cur_pos);
+		json_object_object_add(vendor_specific, "data",
+				       json_object_new_string(encoded));
+		free(encoded);
 
-    return section_ir;
+		json_object_object_add(section_ir, "vendorSpecificInfo",
+				       vendor_specific);
+	}
+
+	return section_ir;
 }
 
 //Converts a single ARM Process Error Information structure into JSON IR.
-json_object* cper_arm_error_info_to_ir(EFI_ARM_ERROR_INFORMATION_ENTRY* error_info)
+json_object *
+cper_arm_error_info_to_ir(EFI_ARM_ERROR_INFORMATION_ENTRY *error_info)
 {
-    json_object* error_info_ir = json_object_new_object();
+	json_object *error_info_ir = json_object_new_object();
 
-    //Version, length.
-    json_object_object_add(error_info_ir, "version", json_object_new_int(error_info->Version));
-    json_object_object_add(error_info_ir, "length", json_object_new_int(error_info->Length));
+	//Version, length.
+	json_object_object_add(error_info_ir, "version",
+			       json_object_new_int(error_info->Version));
+	json_object_object_add(error_info_ir, "length",
+			       json_object_new_int(error_info->Length));
 
-    //Validation bitfield.
-    json_object* validation = bitfield_to_ir(error_info->ValidationBits, 5, ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES);
-    json_object_object_add(error_info_ir, "validationBits", validation);
+	//Validation bitfield.
+	json_object *validation =
+		bitfield_to_ir(error_info->ValidationBits, 5,
+			       ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES);
+	json_object_object_add(error_info_ir, "validationBits", validation);
 
-    //The type of error information in this log.
-    json_object* error_type = integer_to_readable_pair(error_info->Type, 4,
-        ARM_ERROR_INFO_ENTRY_INFO_TYPES_KEYS,
-        ARM_ERROR_INFO_ENTRY_INFO_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(error_info_ir, "errorType", error_type);
+	//The type of error information in this log.
+	json_object *error_type = integer_to_readable_pair(
+		error_info->Type, 4, ARM_ERROR_INFO_ENTRY_INFO_TYPES_KEYS,
+		ARM_ERROR_INFO_ENTRY_INFO_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(error_info_ir, "errorType", error_type);
 
-    //Multiple error count.
-    json_object* multiple_error = json_object_new_object();
-    json_object_object_add(multiple_error, "value", json_object_new_int(error_info->MultipleError));
-    json_object_object_add(multiple_error, "type", 
-        json_object_new_string(error_info->MultipleError < 1 ? "Single Error" : "Multiple Errors"));
-    json_object_object_add(error_info_ir, "multipleError", multiple_error);
+	//Multiple error count.
+	json_object *multiple_error = json_object_new_object();
+	json_object_object_add(multiple_error, "value",
+			       json_object_new_int(error_info->MultipleError));
+	json_object_object_add(
+		multiple_error, "type",
+		json_object_new_string(error_info->MultipleError < 1 ?
+						     "Single Error" :
+						     "Multiple Errors"));
+	json_object_object_add(error_info_ir, "multipleError", multiple_error);
 
-    //Flags.
-    json_object* flags = bitfield_to_ir(error_info->Flags, 4, ARM_ERROR_INFO_ENTRY_FLAGS_NAMES);
-    json_object_object_add(error_info_ir, "flags", flags);
+	//Flags.
+	json_object *flags = bitfield_to_ir(error_info->Flags, 4,
+					    ARM_ERROR_INFO_ENTRY_FLAGS_NAMES);
+	json_object_object_add(error_info_ir, "flags", flags);
 
-    //Error information, split by type.
-    json_object* error_subinfo = NULL;
-    switch (error_info->Type)
-    {
-        case ARM_ERROR_INFORMATION_TYPE_CACHE: //Cache
-        case ARM_ERROR_INFORMATION_TYPE_TLB: //TLB
-            error_subinfo = cper_arm_cache_tlb_error_to_ir((EFI_ARM_CACHE_ERROR_STRUCTURE*)&error_info->ErrorInformation, error_info);
-            break;
-        case ARM_ERROR_INFORMATION_TYPE_BUS: //Bus
-            error_subinfo = cper_arm_bus_error_to_ir((EFI_ARM_BUS_ERROR_STRUCTURE*)&error_info->ErrorInformation);
-            break;
+	//Error information, split by type.
+	json_object *error_subinfo = NULL;
+	switch (error_info->Type) {
+	case ARM_ERROR_INFORMATION_TYPE_CACHE: //Cache
+	case ARM_ERROR_INFORMATION_TYPE_TLB: //TLB
+		error_subinfo = cper_arm_cache_tlb_error_to_ir(
+			(EFI_ARM_CACHE_ERROR_STRUCTURE *)&error_info
+				->ErrorInformation,
+			error_info);
+		break;
+	case ARM_ERROR_INFORMATION_TYPE_BUS: //Bus
+		error_subinfo = cper_arm_bus_error_to_ir(
+			(EFI_ARM_BUS_ERROR_STRUCTURE *)&error_info
+				->ErrorInformation);
+		break;
 
-        default:
-            //Unknown/microarch, so can't be made readable. Simply dump as a uint64 data object.
-            error_subinfo = json_object_new_object();
-            json_object_object_add(error_subinfo, "data", json_object_new_uint64(*((UINT64*)&error_info->ErrorInformation)));
-            break;
-    }
-    json_object_object_add(error_info_ir, "errorInformation", error_subinfo);
+	default:
+		//Unknown/microarch, so can't be made readable. Simply dump as a uint64 data object.
+		error_subinfo = json_object_new_object();
+		json_object_object_add(
+			error_subinfo, "data",
+			json_object_new_uint64(
+				*((UINT64 *)&error_info->ErrorInformation)));
+		break;
+	}
+	json_object_object_add(error_info_ir, "errorInformation",
+			       error_subinfo);
 
-    //Virtual fault address, physical fault address.
-    json_object_object_add(error_info_ir, "virtualFaultAddress", json_object_new_uint64(error_info->VirtualFaultAddress));
-    json_object_object_add(error_info_ir, "physicalFaultAddress", json_object_new_uint64(error_info->PhysicalFaultAddress));
-    
-    return error_info_ir;
+	//Virtual fault address, physical fault address.
+	json_object_object_add(
+		error_info_ir, "virtualFaultAddress",
+		json_object_new_uint64(error_info->VirtualFaultAddress));
+	json_object_object_add(
+		error_info_ir, "physicalFaultAddress",
+		json_object_new_uint64(error_info->PhysicalFaultAddress));
+
+	return error_info_ir;
 }
 
 //Converts a single ARM cache/TLB error information structure into JSON IR format.
-json_object* cper_arm_cache_tlb_error_to_ir(EFI_ARM_CACHE_ERROR_STRUCTURE* cache_tlb_error, EFI_ARM_ERROR_INFORMATION_ENTRY* error_info)
+json_object *
+cper_arm_cache_tlb_error_to_ir(EFI_ARM_CACHE_ERROR_STRUCTURE *cache_tlb_error,
+			       EFI_ARM_ERROR_INFORMATION_ENTRY *error_info)
 {
-    json_object* cache_tlb_error_ir = json_object_new_object();
+	json_object *cache_tlb_error_ir = json_object_new_object();
 
-    //Validation bitfield.
-    json_object* validation = bitfield_to_ir(cache_tlb_error->ValidationBits, 7, ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(cache_tlb_error_ir, "validationBits", validation);
+	//Validation bitfield.
+	json_object *validation =
+		bitfield_to_ir(cache_tlb_error->ValidationBits, 7,
+			       ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(cache_tlb_error_ir, "validationBits",
+			       validation);
 
-    //Transaction type.
-    json_object* transaction_type = integer_to_readable_pair(cache_tlb_error->TransactionType, 3,
-        ARM_ERROR_TRANSACTION_TYPES_KEYS,
-        ARM_ERROR_TRANSACTION_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(cache_tlb_error_ir, "transactionType", transaction_type);
+	//Transaction type.
+	json_object *transaction_type = integer_to_readable_pair(
+		cache_tlb_error->TransactionType, 3,
+		ARM_ERROR_TRANSACTION_TYPES_KEYS,
+		ARM_ERROR_TRANSACTION_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(cache_tlb_error_ir, "transactionType",
+			       transaction_type);
 
-    //Operation.
-    json_object* operation;
-    if (error_info->Type == 0)
-    {
-        //Cache operation.
-        operation = integer_to_readable_pair(cache_tlb_error->Operation, 11,
-            ARM_CACHE_BUS_OPERATION_TYPES_KEYS,
-            ARM_CACHE_BUS_OPERATION_TYPES_VALUES,
-            "Unknown (Reserved)");
-    }
-    else
-    {
-        //TLB operation.
-        operation = integer_to_readable_pair(cache_tlb_error->Operation, 9,
-            ARM_TLB_OPERATION_TYPES_KEYS,
-            ARM_TLB_OPERATION_TYPES_VALUES,
-            "Unknown (Reserved)");
-    }
-    json_object_object_add(cache_tlb_error_ir, "operation", operation);
+	//Operation.
+	json_object *operation;
+	if (error_info->Type == 0) {
+		//Cache operation.
+		operation = integer_to_readable_pair(
+			cache_tlb_error->Operation, 11,
+			ARM_CACHE_BUS_OPERATION_TYPES_KEYS,
+			ARM_CACHE_BUS_OPERATION_TYPES_VALUES,
+			"Unknown (Reserved)");
+	} else {
+		//TLB operation.
+		operation = integer_to_readable_pair(
+			cache_tlb_error->Operation, 9,
+			ARM_TLB_OPERATION_TYPES_KEYS,
+			ARM_TLB_OPERATION_TYPES_VALUES, "Unknown (Reserved)");
+	}
+	json_object_object_add(cache_tlb_error_ir, "operation", operation);
 
-    //Miscellaneous remaining fields.
-    json_object_object_add(cache_tlb_error_ir, "level", json_object_new_int(cache_tlb_error->Level));
-    json_object_object_add(cache_tlb_error_ir, "processorContextCorrupt", json_object_new_boolean(cache_tlb_error->ProcessorContextCorrupt));
-    json_object_object_add(cache_tlb_error_ir, "corrected", json_object_new_boolean(cache_tlb_error->Corrected));
-    json_object_object_add(cache_tlb_error_ir, "precisePC", json_object_new_boolean(cache_tlb_error->PrecisePC));
-    json_object_object_add(cache_tlb_error_ir, "restartablePC", json_object_new_boolean(cache_tlb_error->RestartablePC));
-    return cache_tlb_error_ir;
+	//Miscellaneous remaining fields.
+	json_object_object_add(cache_tlb_error_ir, "level",
+			       json_object_new_int(cache_tlb_error->Level));
+	json_object_object_add(
+		cache_tlb_error_ir, "processorContextCorrupt",
+		json_object_new_boolean(
+			cache_tlb_error->ProcessorContextCorrupt));
+	json_object_object_add(
+		cache_tlb_error_ir, "corrected",
+		json_object_new_boolean(cache_tlb_error->Corrected));
+	json_object_object_add(
+		cache_tlb_error_ir, "precisePC",
+		json_object_new_boolean(cache_tlb_error->PrecisePC));
+	json_object_object_add(
+		cache_tlb_error_ir, "restartablePC",
+		json_object_new_boolean(cache_tlb_error->RestartablePC));
+	return cache_tlb_error_ir;
 }
 
 //Converts a single ARM bus error information structure into JSON IR format.
-json_object* cper_arm_bus_error_to_ir(EFI_ARM_BUS_ERROR_STRUCTURE* bus_error)
+json_object *cper_arm_bus_error_to_ir(EFI_ARM_BUS_ERROR_STRUCTURE *bus_error)
 {
-    json_object* bus_error_ir = json_object_new_object();
+	json_object *bus_error_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(bus_error->ValidationBits, 12, ARM_BUS_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(bus_error_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(bus_error->ValidationBits, 12,
+			       ARM_BUS_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(bus_error_ir, "validationBits", validation);
 
-    //Transaction type.
-    json_object* transaction_type = integer_to_readable_pair(bus_error->TransactionType, 3,
-        ARM_ERROR_TRANSACTION_TYPES_KEYS,
-        ARM_ERROR_TRANSACTION_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(bus_error_ir, "transactionType", transaction_type);
+	//Transaction type.
+	json_object *transaction_type = integer_to_readable_pair(
+		bus_error->TransactionType, 3, ARM_ERROR_TRANSACTION_TYPES_KEYS,
+		ARM_ERROR_TRANSACTION_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(bus_error_ir, "transactionType",
+			       transaction_type);
 
-    //Operation.
-    json_object* operation = integer_to_readable_pair(bus_error->Operation, 7,
-        ARM_CACHE_BUS_OPERATION_TYPES_KEYS,
-        ARM_CACHE_BUS_OPERATION_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(bus_error_ir, "operation", operation);
+	//Operation.
+	json_object *operation = integer_to_readable_pair(
+		bus_error->Operation, 7, ARM_CACHE_BUS_OPERATION_TYPES_KEYS,
+		ARM_CACHE_BUS_OPERATION_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(bus_error_ir, "operation", operation);
 
-    //Affinity level of bus error, + miscellaneous fields.
-    json_object_object_add(bus_error_ir, "level", json_object_new_int(bus_error->Level));
-    json_object_object_add(bus_error_ir, "processorContextCorrupt", json_object_new_boolean(bus_error->ProcessorContextCorrupt));
-    json_object_object_add(bus_error_ir, "corrected", json_object_new_boolean(bus_error->Corrected));
-    json_object_object_add(bus_error_ir, "precisePC", json_object_new_boolean(bus_error->PrecisePC));
-    json_object_object_add(bus_error_ir, "restartablePC", json_object_new_boolean(bus_error->RestartablePC));
-    json_object_object_add(bus_error_ir, "timedOut", json_object_new_boolean(bus_error->TimeOut));
+	//Affinity level of bus error, + miscellaneous fields.
+	json_object_object_add(bus_error_ir, "level",
+			       json_object_new_int(bus_error->Level));
+	json_object_object_add(
+		bus_error_ir, "processorContextCorrupt",
+		json_object_new_boolean(bus_error->ProcessorContextCorrupt));
+	json_object_object_add(bus_error_ir, "corrected",
+			       json_object_new_boolean(bus_error->Corrected));
+	json_object_object_add(bus_error_ir, "precisePC",
+			       json_object_new_boolean(bus_error->PrecisePC));
+	json_object_object_add(
+		bus_error_ir, "restartablePC",
+		json_object_new_boolean(bus_error->RestartablePC));
+	json_object_object_add(bus_error_ir, "timedOut",
+			       json_object_new_boolean(bus_error->TimeOut));
 
-    //Participation type.
-    json_object* participation_type = integer_to_readable_pair(bus_error->ParticipationType, 4,
-        ARM_BUS_PARTICIPATION_TYPES_KEYS,
-        ARM_BUS_PARTICIPATION_TYPES_VALUES,
-        "Unknown");
-    json_object_object_add(bus_error_ir, "participationType", participation_type);
+	//Participation type.
+	json_object *participation_type = integer_to_readable_pair(
+		bus_error->ParticipationType, 4,
+		ARM_BUS_PARTICIPATION_TYPES_KEYS,
+		ARM_BUS_PARTICIPATION_TYPES_VALUES, "Unknown");
+	json_object_object_add(bus_error_ir, "participationType",
+			       participation_type);
 
-    //Address space.
-    json_object* address_space = integer_to_readable_pair(bus_error->AddressSpace, 3,
-        ARM_BUS_ADDRESS_SPACE_TYPES_KEYS,
-        ARM_BUS_ADDRESS_SPACE_TYPES_VALUES,
-        "Unknown");
-    json_object_object_add(bus_error_ir, "addressSpace", address_space);
+	//Address space.
+	json_object *address_space = integer_to_readable_pair(
+		bus_error->AddressSpace, 3, ARM_BUS_ADDRESS_SPACE_TYPES_KEYS,
+		ARM_BUS_ADDRESS_SPACE_TYPES_VALUES, "Unknown");
+	json_object_object_add(bus_error_ir, "addressSpace", address_space);
 
-    //Memory access attributes.
-    //todo: find the specification of these in the ARM ARM
-    json_object_object_add(bus_error_ir, "memoryAttributes", json_object_new_int(bus_error->MemoryAddressAttributes));
+	//Memory access attributes.
+	//todo: find the specification of these in the ARM ARM
+	json_object_object_add(
+		bus_error_ir, "memoryAttributes",
+		json_object_new_int(bus_error->MemoryAddressAttributes));
 
-    //Access Mode
-    json_object* access_mode = json_object_new_object();
-    json_object_object_add(access_mode, "value", json_object_new_int(bus_error->AccessMode));
-    json_object_object_add(access_mode, "name", json_object_new_string(bus_error->AccessMode == 0 ? "Secure" : "Normal"));
-    json_object_object_add(bus_error_ir, "accessMode", access_mode);
+	//Access Mode
+	json_object *access_mode = json_object_new_object();
+	json_object_object_add(access_mode, "value",
+			       json_object_new_int(bus_error->AccessMode));
+	json_object_object_add(
+		access_mode, "name",
+		json_object_new_string(bus_error->AccessMode == 0 ? "Secure" :
+									  "Normal"));
+	json_object_object_add(bus_error_ir, "accessMode", access_mode);
 
-    return bus_error_ir;
+	return bus_error_ir;
 }
 
 //Converts a single ARM processor context block into JSON IR.
-json_object* cper_arm_processor_context_to_ir(EFI_ARM_CONTEXT_INFORMATION_HEADER* header, void** cur_pos)
+json_object *
+cper_arm_processor_context_to_ir(EFI_ARM_CONTEXT_INFORMATION_HEADER *header,
+				 void **cur_pos)
 {
-    json_object* context_ir = json_object_new_object();
+	json_object *context_ir = json_object_new_object();
 
-    //Version.
-    json_object_object_add(context_ir, "version", json_object_new_int(header->Version));
+	//Version.
+	json_object_object_add(context_ir, "version",
+			       json_object_new_int(header->Version));
 
-    //Add the context type.
-    json_object* context_type = integer_to_readable_pair(header->RegisterContextType, 9,
-        ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_KEYS,
-        ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(context_ir, "registerContextType", context_type);
+	//Add the context type.
+	json_object *context_type = integer_to_readable_pair(
+		header->RegisterContextType, 9,
+		ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_KEYS,
+		ARM_PROCESSOR_INFO_REGISTER_CONTEXT_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(context_ir, "registerContextType", context_type);
 
-    //Register array size (bytes).
-    json_object_object_add(context_ir, "registerArraySize", json_object_new_uint64(header->RegisterArraySize));
+	//Register array size (bytes).
+	json_object_object_add(
+		context_ir, "registerArraySize",
+		json_object_new_uint64(header->RegisterArraySize));
 
-    //The register array itself.
-    *cur_pos = (void*)(header + 1);
-    json_object* register_array = NULL;
-    switch (header->RegisterContextType)
-    {
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_GPR:
-            register_array = uniform_struct_to_ir((UINT32*)cur_pos, 
-                sizeof(EFI_ARM_V8_AARCH32_GPR) / sizeof(UINT32), ARM_AARCH32_GPR_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_EL1:
-            register_array = uniform_struct_to_ir((UINT32*)cur_pos, 
-                sizeof(EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS) / sizeof(UINT32), ARM_AARCH32_EL1_REGISTER_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_EL2:
-            register_array = uniform_struct_to_ir((UINT32*)cur_pos, 
-                sizeof(EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS) / sizeof(UINT32), ARM_AARCH32_EL2_REGISTER_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE:
-            register_array = uniform_struct_to_ir((UINT32*)cur_pos, 
-                sizeof(EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS) / sizeof(UINT32), ARM_AARCH32_SECURE_REGISTER_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_GPR:
-            register_array = uniform_struct64_to_ir((UINT64*)cur_pos, 
-                sizeof(EFI_ARM_V8_AARCH64_GPR) / sizeof(UINT64), ARM_AARCH64_GPR_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_EL1:
-            register_array = uniform_struct64_to_ir((UINT64*)cur_pos, 
-                sizeof(EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS) / sizeof(UINT64), ARM_AARCH64_EL1_REGISTER_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_EL2:
-            register_array = uniform_struct64_to_ir((UINT64*)cur_pos, 
-                sizeof(EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS) / sizeof(UINT64), ARM_AARCH64_EL2_REGISTER_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_EL3:
-            register_array = uniform_struct64_to_ir((UINT64*)cur_pos, 
-                sizeof(EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS) / sizeof(UINT64), ARM_AARCH64_EL3_REGISTER_NAMES);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_MISC:
-            register_array = cper_arm_misc_register_array_to_ir((EFI_ARM_MISC_CONTEXT_REGISTER*)cur_pos);
-            break;
-        default:
-            //Unknown register array type, add as base64 data instead.
-            register_array = json_object_new_object();
-            char* encoded = b64_encode((unsigned char*)cur_pos, header->RegisterArraySize);
-            json_object_object_add(register_array, "data", json_object_new_string(encoded));
-            free(encoded);
-            break;
-    }
-    json_object_object_add(context_ir, "registerArray", register_array);
+	//The register array itself.
+	*cur_pos = (void *)(header + 1);
+	json_object *register_array = NULL;
+	switch (header->RegisterContextType) {
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_GPR:
+		register_array = uniform_struct_to_ir(
+			(UINT32 *)cur_pos,
+			sizeof(EFI_ARM_V8_AARCH32_GPR) / sizeof(UINT32),
+			ARM_AARCH32_GPR_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_EL1:
+		register_array = uniform_struct_to_ir(
+			(UINT32 *)cur_pos,
+			sizeof(EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS) /
+				sizeof(UINT32),
+			ARM_AARCH32_EL1_REGISTER_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_EL2:
+		register_array = uniform_struct_to_ir(
+			(UINT32 *)cur_pos,
+			sizeof(EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS) /
+				sizeof(UINT32),
+			ARM_AARCH32_EL2_REGISTER_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE:
+		register_array = uniform_struct_to_ir(
+			(UINT32 *)cur_pos,
+			sizeof(EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS) /
+				sizeof(UINT32),
+			ARM_AARCH32_SECURE_REGISTER_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_GPR:
+		register_array = uniform_struct64_to_ir(
+			(UINT64 *)cur_pos,
+			sizeof(EFI_ARM_V8_AARCH64_GPR) / sizeof(UINT64),
+			ARM_AARCH64_GPR_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_EL1:
+		register_array = uniform_struct64_to_ir(
+			(UINT64 *)cur_pos,
+			sizeof(EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS) /
+				sizeof(UINT64),
+			ARM_AARCH64_EL1_REGISTER_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_EL2:
+		register_array = uniform_struct64_to_ir(
+			(UINT64 *)cur_pos,
+			sizeof(EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS) /
+				sizeof(UINT64),
+			ARM_AARCH64_EL2_REGISTER_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_EL3:
+		register_array = uniform_struct64_to_ir(
+			(UINT64 *)cur_pos,
+			sizeof(EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS) /
+				sizeof(UINT64),
+			ARM_AARCH64_EL3_REGISTER_NAMES);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_MISC:
+		register_array = cper_arm_misc_register_array_to_ir(
+			(EFI_ARM_MISC_CONTEXT_REGISTER *)cur_pos);
+		break;
+	default:
+		//Unknown register array type, add as base64 data instead.
+		register_array = json_object_new_object();
+		char *encoded = b64_encode((unsigned char *)cur_pos,
+					   header->RegisterArraySize);
+		json_object_object_add(register_array, "data",
+				       json_object_new_string(encoded));
+		free(encoded);
+		break;
+	}
+	json_object_object_add(context_ir, "registerArray", register_array);
 
-    //Set the current position to after the processor context structure.
-    *cur_pos = (UINT8*)(*cur_pos) + header->RegisterArraySize;
+	//Set the current position to after the processor context structure.
+	*cur_pos = (UINT8 *)(*cur_pos) + header->RegisterArraySize;
 
-    return context_ir;
+	return context_ir;
 }
 
 //Converts a single CPER ARM miscellaneous register array to JSON IR format.
-json_object* cper_arm_misc_register_array_to_ir(EFI_ARM_MISC_CONTEXT_REGISTER* misc_register)
+json_object *
+cper_arm_misc_register_array_to_ir(EFI_ARM_MISC_CONTEXT_REGISTER *misc_register)
 {
-    json_object* register_array = json_object_new_object();
-    json_object* mrs_encoding = json_object_new_object();
-    json_object_object_add(mrs_encoding, "op2", json_object_new_uint64(misc_register->MrsOp2));
-    json_object_object_add(mrs_encoding, "crm", json_object_new_uint64(misc_register->MrsCrm));
-    json_object_object_add(mrs_encoding, "crn", json_object_new_uint64(misc_register->MrsCrn));
-    json_object_object_add(mrs_encoding, "op1", json_object_new_uint64(misc_register->MrsOp1));
-    json_object_object_add(mrs_encoding, "o0", json_object_new_uint64(misc_register->MrsO0));
-    json_object_object_add(register_array, "mrsEncoding", mrs_encoding);
-    json_object_object_add(register_array, "value", json_object_new_uint64(misc_register->Value));
+	json_object *register_array = json_object_new_object();
+	json_object *mrs_encoding = json_object_new_object();
+	json_object_object_add(mrs_encoding, "op2",
+			       json_object_new_uint64(misc_register->MrsOp2));
+	json_object_object_add(mrs_encoding, "crm",
+			       json_object_new_uint64(misc_register->MrsCrm));
+	json_object_object_add(mrs_encoding, "crn",
+			       json_object_new_uint64(misc_register->MrsCrn));
+	json_object_object_add(mrs_encoding, "op1",
+			       json_object_new_uint64(misc_register->MrsOp1));
+	json_object_object_add(mrs_encoding, "o0",
+			       json_object_new_uint64(misc_register->MrsO0));
+	json_object_object_add(register_array, "mrsEncoding", mrs_encoding);
+	json_object_object_add(register_array, "value",
+			       json_object_new_uint64(misc_register->Value));
 
-    return register_array;
+	return register_array;
 }
 
 //Converts a single CPER-JSON ARM error section into CPER binary, outputting to the given stream.
-void ir_section_arm_to_cper(json_object* section, FILE* out)
+void ir_section_arm_to_cper(json_object *section, FILE *out)
 {
-    EFI_ARM_ERROR_RECORD* section_cper = (EFI_ARM_ERROR_RECORD*)calloc(1, sizeof(EFI_ARM_ERROR_RECORD));
-    long starting_stream_pos = ftell(out);
+	EFI_ARM_ERROR_RECORD *section_cper =
+		(EFI_ARM_ERROR_RECORD *)calloc(1, sizeof(EFI_ARM_ERROR_RECORD));
+	long starting_stream_pos = ftell(out);
 
-    //Validation bits.
-    section_cper->ValidFields = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        4, ARM_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 4,
+		ARM_ERROR_VALID_BITFIELD_NAMES);
 
-    //Count of error/context info structures.
-    section_cper->ErrInfoNum = json_object_get_int(json_object_object_get(section, "errorInfoNum"));
-    section_cper->ContextInfoNum = json_object_get_int(json_object_object_get(section, "contextInfoNum"));
+	//Count of error/context info structures.
+	section_cper->ErrInfoNum = json_object_get_int(
+		json_object_object_get(section, "errorInfoNum"));
+	section_cper->ContextInfoNum = json_object_get_int(
+		json_object_object_get(section, "contextInfoNum"));
 
-    //Miscellaneous raw value fields.
-    section_cper->SectionLength = json_object_get_uint64(json_object_object_get(section, "sectionLength"));
-    section_cper->ErrorAffinityLevel = readable_pair_to_integer(json_object_object_get(section, "errorAffinity"));
-    section_cper->MPIDR_EL1 = json_object_get_uint64(json_object_object_get(section, "mpidrEl1"));
-    section_cper->MIDR_EL1 = json_object_get_uint64(json_object_object_get(section, "midrEl1"));
-    section_cper->RunningState = json_object_get_boolean(json_object_object_get(section, "running"));
+	//Miscellaneous raw value fields.
+	section_cper->SectionLength = json_object_get_uint64(
+		json_object_object_get(section, "sectionLength"));
+	section_cper->ErrorAffinityLevel = readable_pair_to_integer(
+		json_object_object_get(section, "errorAffinity"));
+	section_cper->MPIDR_EL1 = json_object_get_uint64(
+		json_object_object_get(section, "mpidrEl1"));
+	section_cper->MIDR_EL1 = json_object_get_uint64(
+		json_object_object_get(section, "midrEl1"));
+	section_cper->RunningState = json_object_get_boolean(
+		json_object_object_get(section, "running"));
 
-    //Optional PSCI state.
-    json_object* psci_state = json_object_object_get(section, "psciState");
-    if (psci_state != NULL)
-        section_cper->PsciState = json_object_get_uint64(psci_state);
+	//Optional PSCI state.
+	json_object *psci_state = json_object_object_get(section, "psciState");
+	if (psci_state != NULL)
+		section_cper->PsciState = json_object_get_uint64(psci_state);
 
-    //Flush header to stream.
-    fwrite(section_cper, sizeof(EFI_ARM_ERROR_RECORD), 1, out);
-    fflush(out);
+	//Flush header to stream.
+	fwrite(section_cper, sizeof(EFI_ARM_ERROR_RECORD), 1, out);
+	fflush(out);
 
-    //Error info structure array.
-    json_object* error_info = json_object_object_get(section, "errorInfo");
-    for (int i=0; i<section_cper->ErrInfoNum; i++)
-        ir_arm_error_info_to_cper(json_object_array_get_idx(error_info, i), out);
+	//Error info structure array.
+	json_object *error_info = json_object_object_get(section, "errorInfo");
+	for (int i = 0; i < section_cper->ErrInfoNum; i++)
+		ir_arm_error_info_to_cper(
+			json_object_array_get_idx(error_info, i), out);
 
-    //Context info structure array.
-    json_object* context_info = json_object_object_get(section, "contextInfo");
-    for (int i=0; i<section_cper->ContextInfoNum; i++)
-        ir_arm_context_info_to_cper(json_object_array_get_idx(context_info, i), out);
+	//Context info structure array.
+	json_object *context_info =
+		json_object_object_get(section, "contextInfo");
+	for (int i = 0; i < section_cper->ContextInfoNum; i++)
+		ir_arm_context_info_to_cper(
+			json_object_array_get_idx(context_info, i), out);
 
-    //Vendor specific error info.
-    json_object* vendor_specific_info = json_object_object_get(section, "vendorSpecificInfo");
-    if (vendor_specific_info != NULL)
-    {
-        json_object* vendor_info_string = json_object_object_get(vendor_specific_info, "data");
-        int vendor_specific_len = json_object_get_string_len(vendor_info_string);
-        UINT8* decoded = b64_decode(json_object_get_string(vendor_info_string), vendor_specific_len);
+	//Vendor specific error info.
+	json_object *vendor_specific_info =
+		json_object_object_get(section, "vendorSpecificInfo");
+	if (vendor_specific_info != NULL) {
+		json_object *vendor_info_string =
+			json_object_object_get(vendor_specific_info, "data");
+		int vendor_specific_len =
+			json_object_get_string_len(vendor_info_string);
+		UINT8 *decoded =
+			b64_decode(json_object_get_string(vendor_info_string),
+				   vendor_specific_len);
 
-        //Write out to file.
-        long cur_stream_pos = ftell(out);
-        fwrite(decoded, starting_stream_pos + section_cper->SectionLength - cur_stream_pos, 1, out);
-        fflush(out);
-        free(decoded);
-    }
+		//Write out to file.
+		long cur_stream_pos = ftell(out);
+		fwrite(decoded,
+		       starting_stream_pos + section_cper->SectionLength -
+			       cur_stream_pos,
+		       1, out);
+		fflush(out);
+		free(decoded);
+	}
 
-    //Free remaining resources.
-    free(section_cper);
+	//Free remaining resources.
+	free(section_cper);
 }
 
 //Converts a single ARM error information structure into CPER binary, outputting to the given stream.
-void ir_arm_error_info_to_cper(json_object* error_info, FILE* out)
+void ir_arm_error_info_to_cper(json_object *error_info, FILE *out)
 {
-    EFI_ARM_ERROR_INFORMATION_ENTRY error_info_cper;
+	EFI_ARM_ERROR_INFORMATION_ENTRY error_info_cper;
 
-    //Version, length.
-    error_info_cper.Version = json_object_get_int(json_object_object_get(error_info, "version"));
-    error_info_cper.Length = json_object_get_int(json_object_object_get(error_info, "length"));
+	//Version, length.
+	error_info_cper.Version = json_object_get_int(
+		json_object_object_get(error_info, "version"));
+	error_info_cper.Length = json_object_get_int(
+		json_object_object_get(error_info, "length"));
 
-    //Validation bits.
-    error_info_cper.ValidationBits = ir_to_bitfield(json_object_object_get(error_info, "validationBits"), 
-        5, ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	error_info_cper.ValidationBits = ir_to_bitfield(
+		json_object_object_get(error_info, "validationBits"), 5,
+		ARM_ERROR_INFO_ENTRY_VALID_BITFIELD_NAMES);
 
-    //Type, multiple error.
-    error_info_cper.Type = (UINT8)readable_pair_to_integer(json_object_object_get(error_info, "type"));
-    error_info_cper.MultipleError = (UINT16)readable_pair_to_integer(json_object_object_get(error_info, "multipleError"));
+	//Type, multiple error.
+	error_info_cper.Type = (UINT8)readable_pair_to_integer(
+		json_object_object_get(error_info, "type"));
+	error_info_cper.MultipleError = (UINT16)readable_pair_to_integer(
+		json_object_object_get(error_info, "multipleError"));
 
-    //Flags object.
-    error_info_cper.Flags = (UINT8)ir_to_bitfield(json_object_object_get(error_info, "flags"), 
-        4, ARM_ERROR_INFO_ENTRY_FLAGS_NAMES);
+	//Flags object.
+	error_info_cper.Flags = (UINT8)ir_to_bitfield(
+		json_object_object_get(error_info, "flags"), 4,
+		ARM_ERROR_INFO_ENTRY_FLAGS_NAMES);
 
-    //Error information.
-    json_object* error_info_information = json_object_object_get(error_info, "errorInformation");
-    switch (error_info_cper.Type)
-    {
-        case ARM_ERROR_INFORMATION_TYPE_CACHE:
-        case ARM_ERROR_INFORMATION_TYPE_TLB:
-            ir_arm_error_cache_tlb_info_to_cper(error_info_information, &error_info_cper.ErrorInformation.CacheError);
-            break;
+	//Error information.
+	json_object *error_info_information =
+		json_object_object_get(error_info, "errorInformation");
+	switch (error_info_cper.Type) {
+	case ARM_ERROR_INFORMATION_TYPE_CACHE:
+	case ARM_ERROR_INFORMATION_TYPE_TLB:
+		ir_arm_error_cache_tlb_info_to_cper(
+			error_info_information,
+			&error_info_cper.ErrorInformation.CacheError);
+		break;
 
-        case ARM_ERROR_INFORMATION_TYPE_BUS:
-            ir_arm_error_bus_info_to_cper(error_info_information, &error_info_cper.ErrorInformation.BusError);
-            break;
+	case ARM_ERROR_INFORMATION_TYPE_BUS:
+		ir_arm_error_bus_info_to_cper(
+			error_info_information,
+			&error_info_cper.ErrorInformation.BusError);
+		break;
 
-        default:
-            //Unknown error information type.
-            *((UINT64*)&error_info_cper.ErrorInformation) = 
-                json_object_get_uint64(json_object_object_get(error_info_information, "data"));
-            break;
-    }
+	default:
+		//Unknown error information type.
+		*((UINT64 *)&error_info_cper.ErrorInformation) =
+			json_object_get_uint64(json_object_object_get(
+				error_info_information, "data"));
+		break;
+	}
 
-    //Virtual/physical fault address.
-    error_info_cper.VirtualFaultAddress = json_object_get_uint64(json_object_object_get(error_info, "virtualFaultAddress"));
-    error_info_cper.PhysicalFaultAddress = json_object_get_uint64(json_object_object_get(error_info, "physicalFaultAddress"));
+	//Virtual/physical fault address.
+	error_info_cper.VirtualFaultAddress = json_object_get_uint64(
+		json_object_object_get(error_info, "virtualFaultAddress"));
+	error_info_cper.PhysicalFaultAddress = json_object_get_uint64(
+		json_object_object_get(error_info, "physicalFaultAddress"));
 
-    //Write out to stream.
-    fwrite(&error_info_cper, sizeof(EFI_ARM_ERROR_INFORMATION_ENTRY), 1, out);
-    fflush(out);
+	//Write out to stream.
+	fwrite(&error_info_cper, sizeof(EFI_ARM_ERROR_INFORMATION_ENTRY), 1,
+	       out);
+	fflush(out);
 }
 
 //Converts a single ARM cache/TLB error information structure into a CPER structure.
-void ir_arm_error_cache_tlb_info_to_cper(json_object* error_information, EFI_ARM_CACHE_ERROR_STRUCTURE* error_info_cper)
+void ir_arm_error_cache_tlb_info_to_cper(
+	json_object *error_information,
+	EFI_ARM_CACHE_ERROR_STRUCTURE *error_info_cper)
 {
-    //Validation bits.
-    error_info_cper->ValidationBits = ir_to_bitfield(json_object_object_get(error_information, "validationBits"), 
-        7, ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	error_info_cper->ValidationBits = ir_to_bitfield(
+		json_object_object_get(error_information, "validationBits"), 7,
+		ARM_CACHE_TLB_ERROR_VALID_BITFIELD_NAMES);
 
-    //Miscellaneous value fields.
-    error_info_cper->TransactionType = readable_pair_to_integer(json_object_object_get(error_information, "transactionType"));
-    error_info_cper->Operation = readable_pair_to_integer(json_object_object_get(error_information, "operation"));
-    error_info_cper->Level = json_object_get_uint64(json_object_object_get(error_information, "level"));
-    error_info_cper->ProcessorContextCorrupt = 
-        json_object_get_boolean(json_object_object_get(error_information, "processorContextCorrupt"));
-    error_info_cper->Corrected = json_object_get_boolean(json_object_object_get(error_information, "corrected"));
-    error_info_cper->PrecisePC = json_object_get_boolean(json_object_object_get(error_information, "precisePC"));
-    error_info_cper->RestartablePC = json_object_get_boolean(json_object_object_get(error_information, "restartablePC"));
-    error_info_cper->Reserved = 0;
+	//Miscellaneous value fields.
+	error_info_cper->TransactionType = readable_pair_to_integer(
+		json_object_object_get(error_information, "transactionType"));
+	error_info_cper->Operation = readable_pair_to_integer(
+		json_object_object_get(error_information, "operation"));
+	error_info_cper->Level = json_object_get_uint64(
+		json_object_object_get(error_information, "level"));
+	error_info_cper->ProcessorContextCorrupt = json_object_get_boolean(
+		json_object_object_get(error_information,
+				       "processorContextCorrupt"));
+	error_info_cper->Corrected = json_object_get_boolean(
+		json_object_object_get(error_information, "corrected"));
+	error_info_cper->PrecisePC = json_object_get_boolean(
+		json_object_object_get(error_information, "precisePC"));
+	error_info_cper->RestartablePC = json_object_get_boolean(
+		json_object_object_get(error_information, "restartablePC"));
+	error_info_cper->Reserved = 0;
 }
 
 //Converts a single ARM bus error information structure into a CPER structure.
-void ir_arm_error_bus_info_to_cper(json_object* error_information, EFI_ARM_BUS_ERROR_STRUCTURE* error_info_cper)
+void ir_arm_error_bus_info_to_cper(json_object *error_information,
+				   EFI_ARM_BUS_ERROR_STRUCTURE *error_info_cper)
 {
-    //Validation bits.
-    error_info_cper->ValidationBits = ir_to_bitfield(json_object_object_get(error_information, "validationBits"), 
-        7, ARM_BUS_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	error_info_cper->ValidationBits = ir_to_bitfield(
+		json_object_object_get(error_information, "validationBits"), 7,
+		ARM_BUS_ERROR_VALID_BITFIELD_NAMES);
 
-    //Miscellaneous value fields.
-    error_info_cper->TransactionType = readable_pair_to_integer(json_object_object_get(error_information, "transactionType"));
-    error_info_cper->Operation = readable_pair_to_integer(json_object_object_get(error_information, "operation"));
-    error_info_cper->Level = json_object_get_uint64(json_object_object_get(error_information, "level"));
-    error_info_cper->ProcessorContextCorrupt = 
-        json_object_get_boolean(json_object_object_get(error_information, "processorContextCorrupt"));
-    error_info_cper->Corrected = json_object_get_boolean(json_object_object_get(error_information, "corrected"));
-    error_info_cper->PrecisePC = json_object_get_boolean(json_object_object_get(error_information, "precisePC"));
-    error_info_cper->RestartablePC = json_object_get_boolean(json_object_object_get(error_information, "restartablePC"));
-    error_info_cper->ParticipationType = 
-        readable_pair_to_integer(json_object_object_get(error_information, "participationType"));
-    error_info_cper->AddressSpace = readable_pair_to_integer(json_object_object_get(error_information, "addressSpace"));
-    error_info_cper->AccessMode = readable_pair_to_integer(json_object_object_get(error_information, "accessMode"));
-    error_info_cper->MemoryAddressAttributes = json_object_get_uint64(json_object_object_get(error_information, "memoryAttributes"));
-    error_info_cper->Reserved = 0;
+	//Miscellaneous value fields.
+	error_info_cper->TransactionType = readable_pair_to_integer(
+		json_object_object_get(error_information, "transactionType"));
+	error_info_cper->Operation = readable_pair_to_integer(
+		json_object_object_get(error_information, "operation"));
+	error_info_cper->Level = json_object_get_uint64(
+		json_object_object_get(error_information, "level"));
+	error_info_cper->ProcessorContextCorrupt = json_object_get_boolean(
+		json_object_object_get(error_information,
+				       "processorContextCorrupt"));
+	error_info_cper->Corrected = json_object_get_boolean(
+		json_object_object_get(error_information, "corrected"));
+	error_info_cper->PrecisePC = json_object_get_boolean(
+		json_object_object_get(error_information, "precisePC"));
+	error_info_cper->RestartablePC = json_object_get_boolean(
+		json_object_object_get(error_information, "restartablePC"));
+	error_info_cper->ParticipationType = readable_pair_to_integer(
+		json_object_object_get(error_information, "participationType"));
+	error_info_cper->AddressSpace = readable_pair_to_integer(
+		json_object_object_get(error_information, "addressSpace"));
+	error_info_cper->AccessMode = readable_pair_to_integer(
+		json_object_object_get(error_information, "accessMode"));
+	error_info_cper->MemoryAddressAttributes = json_object_get_uint64(
+		json_object_object_get(error_information, "memoryAttributes"));
+	error_info_cper->Reserved = 0;
 }
 
 //Converts a single ARM context information structure into CPER binary, outputting to the given stream.
-void ir_arm_context_info_to_cper(json_object* context_info, FILE* out)
+void ir_arm_context_info_to_cper(json_object *context_info, FILE *out)
 {
-    EFI_ARM_CONTEXT_INFORMATION_HEADER info_header;
+	EFI_ARM_CONTEXT_INFORMATION_HEADER info_header;
 
-    //Version, array size, context type.
-    info_header.Version = json_object_get_int(json_object_object_get(context_info, "version"));
-    info_header.RegisterArraySize = json_object_get_int(json_object_object_get(context_info, "registerArraySize"));
-    info_header.RegisterContextType = readable_pair_to_integer(json_object_object_get(context_info, "registerContextType"));
+	//Version, array size, context type.
+	info_header.Version = json_object_get_int(
+		json_object_object_get(context_info, "version"));
+	info_header.RegisterArraySize = json_object_get_int(
+		json_object_object_get(context_info, "registerArraySize"));
+	info_header.RegisterContextType = readable_pair_to_integer(
+		json_object_object_get(context_info, "registerContextType"));
 
-    //Flush to stream, write the register array itself.
-    fwrite(&info_header, sizeof(EFI_ARM_CONTEXT_INFORMATION_HEADER), 1, out);
-    fflush(out);
+	//Flush to stream, write the register array itself.
+	fwrite(&info_header, sizeof(EFI_ARM_CONTEXT_INFORMATION_HEADER), 1,
+	       out);
+	fflush(out);
 
-    json_object* register_array = json_object_object_get(context_info, "registerArray");
-    switch (info_header.RegisterContextType)
-    {
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_GPR:
-            ir_arm_aarch32_gpr_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_EL1:
-            ir_arm_aarch32_el1_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_EL2:
-            ir_arm_aarch32_el2_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE:
-            ir_arm_aarch32_secure_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_GPR:
-            ir_arm_aarch64_gpr_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_EL1:
-            ir_arm_aarch64_el1_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_EL2:
-            ir_arm_aarch64_el2_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_AARCH64_EL3:
-            ir_arm_aarch64_el3_to_cper(register_array, out);
-            break;
-        case EFI_ARM_CONTEXT_TYPE_MISC:
-            ir_arm_misc_registers_to_cper(register_array, out);
-            break;
-        default:
-            //Unknown register structure.
-            ir_arm_unknown_register_to_cper(register_array, &info_header, out);
-            break;
-    }
+	json_object *register_array =
+		json_object_object_get(context_info, "registerArray");
+	switch (info_header.RegisterContextType) {
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_GPR:
+		ir_arm_aarch32_gpr_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_EL1:
+		ir_arm_aarch32_el1_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_EL2:
+		ir_arm_aarch32_el2_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH32_SECURE:
+		ir_arm_aarch32_secure_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_GPR:
+		ir_arm_aarch64_gpr_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_EL1:
+		ir_arm_aarch64_el1_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_EL2:
+		ir_arm_aarch64_el2_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_AARCH64_EL3:
+		ir_arm_aarch64_el3_to_cper(register_array, out);
+		break;
+	case EFI_ARM_CONTEXT_TYPE_MISC:
+		ir_arm_misc_registers_to_cper(register_array, out);
+		break;
+	default:
+		//Unknown register structure.
+		ir_arm_unknown_register_to_cper(register_array, &info_header,
+						out);
+		break;
+	}
 }
 
 //Converts a single AARCH32 GPR CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch32_gpr_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch32_gpr_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_V8_AARCH32_GPR reg_array;
-    ir_to_uniform_struct(registers, (UINT32*)&reg_array, 
-        sizeof(EFI_ARM_V8_AARCH32_GPR) / sizeof(UINT32), ARM_AARCH32_GPR_NAMES);
+	//Get uniform register array.
+	EFI_ARM_V8_AARCH32_GPR reg_array;
+	ir_to_uniform_struct(registers, (UINT32 *)&reg_array,
+			     sizeof(EFI_ARM_V8_AARCH32_GPR) / sizeof(UINT32),
+			     ARM_AARCH32_GPR_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single AARCH32 EL1 register set CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch32_el1_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch32_el1_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS reg_array;
-    ir_to_uniform_struct(registers, (UINT32*)&reg_array, 
-        sizeof(EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS) / sizeof(UINT32), ARM_AARCH32_EL1_REGISTER_NAMES);
+	//Get uniform register array.
+	EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS reg_array;
+	ir_to_uniform_struct(registers, (UINT32 *)&reg_array,
+			     sizeof(EFI_ARM_AARCH32_EL1_CONTEXT_REGISTERS) /
+				     sizeof(UINT32),
+			     ARM_AARCH32_EL1_REGISTER_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single AARCH32 EL2 register set CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch32_el2_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch32_el2_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS reg_array;
-    ir_to_uniform_struct(registers, (UINT32*)&reg_array, 
-        sizeof(EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS) / sizeof(UINT32), ARM_AARCH32_EL2_REGISTER_NAMES);
+	//Get uniform register array.
+	EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS reg_array;
+	ir_to_uniform_struct(registers, (UINT32 *)&reg_array,
+			     sizeof(EFI_ARM_AARCH32_EL2_CONTEXT_REGISTERS) /
+				     sizeof(UINT32),
+			     ARM_AARCH32_EL2_REGISTER_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single AARCH32 secure register set CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch32_secure_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch32_secure_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS reg_array;
-    ir_to_uniform_struct(registers, (UINT32*)&reg_array, 
-        sizeof(EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS) / sizeof(UINT32), ARM_AARCH32_SECURE_REGISTER_NAMES);
+	//Get uniform register array.
+	EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS reg_array;
+	ir_to_uniform_struct(registers, (UINT32 *)&reg_array,
+			     sizeof(EFI_ARM_AARCH32_SECURE_CONTEXT_REGISTERS) /
+				     sizeof(UINT32),
+			     ARM_AARCH32_SECURE_REGISTER_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single AARCH64 GPR CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch64_gpr_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch64_gpr_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_V8_AARCH64_GPR reg_array;
-    ir_to_uniform_struct64(registers, (UINT64*)&reg_array, 
-        sizeof(EFI_ARM_V8_AARCH64_GPR) / sizeof(UINT64), ARM_AARCH64_GPR_NAMES);
+	//Get uniform register array.
+	EFI_ARM_V8_AARCH64_GPR reg_array;
+	ir_to_uniform_struct64(registers, (UINT64 *)&reg_array,
+			       sizeof(EFI_ARM_V8_AARCH64_GPR) / sizeof(UINT64),
+			       ARM_AARCH64_GPR_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single AARCH64 EL1 register set CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch64_el1_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch64_el1_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS reg_array;
-    ir_to_uniform_struct64(registers, (UINT64*)&reg_array, 
-        sizeof(EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS) / sizeof(UINT64), ARM_AARCH64_EL1_REGISTER_NAMES);
+	//Get uniform register array.
+	EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS reg_array;
+	ir_to_uniform_struct64(registers, (UINT64 *)&reg_array,
+			       sizeof(EFI_ARM_AARCH64_EL1_CONTEXT_REGISTERS) /
+				       sizeof(UINT64),
+			       ARM_AARCH64_EL1_REGISTER_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single AARCH64 EL2 register set CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch64_el2_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch64_el2_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS reg_array;
-    ir_to_uniform_struct64(registers, (UINT64*)&reg_array, 
-        sizeof(EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS) / sizeof(UINT64), ARM_AARCH64_EL2_REGISTER_NAMES);
+	//Get uniform register array.
+	EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS reg_array;
+	ir_to_uniform_struct64(registers, (UINT64 *)&reg_array,
+			       sizeof(EFI_ARM_AARCH64_EL2_CONTEXT_REGISTERS) /
+				       sizeof(UINT64),
+			       ARM_AARCH64_EL2_REGISTER_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single AARCH64 EL3 register set CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_aarch64_el3_to_cper(json_object* registers, FILE* out)
+void ir_arm_aarch64_el3_to_cper(json_object *registers, FILE *out)
 {
-    //Get uniform register array.
-    EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS reg_array;
-    ir_to_uniform_struct64(registers, (UINT64*)&reg_array, 
-        sizeof(EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS) / sizeof(UINT64), ARM_AARCH64_EL3_REGISTER_NAMES);
+	//Get uniform register array.
+	EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS reg_array;
+	ir_to_uniform_struct64(registers, (UINT64 *)&reg_array,
+			       sizeof(EFI_ARM_AARCH64_EL3_CONTEXT_REGISTERS) /
+				       sizeof(UINT64),
+			       ARM_AARCH64_EL3_REGISTER_NAMES);
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single ARM miscellaneous register set CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_misc_registers_to_cper(json_object* registers, FILE* out)
+void ir_arm_misc_registers_to_cper(json_object *registers, FILE *out)
 {
-    EFI_ARM_MISC_CONTEXT_REGISTER reg_array;
+	EFI_ARM_MISC_CONTEXT_REGISTER reg_array;
 
-    //MRS encoding information.
-    json_object* mrs_encoding = json_object_object_get(registers, "mrsEncoding");
-    reg_array.MrsOp2 = json_object_get_uint64(json_object_object_get(mrs_encoding, "op2"));
-    reg_array.MrsCrm = json_object_get_uint64(json_object_object_get(mrs_encoding, "crm"));
-    reg_array.MrsCrn = json_object_get_uint64(json_object_object_get(mrs_encoding, "crn"));
-    reg_array.MrsOp1 = json_object_get_uint64(json_object_object_get(mrs_encoding, "op1"));
-    reg_array.MrsO0 = json_object_get_uint64(json_object_object_get(mrs_encoding, "o0"));
+	//MRS encoding information.
+	json_object *mrs_encoding =
+		json_object_object_get(registers, "mrsEncoding");
+	reg_array.MrsOp2 = json_object_get_uint64(
+		json_object_object_get(mrs_encoding, "op2"));
+	reg_array.MrsCrm = json_object_get_uint64(
+		json_object_object_get(mrs_encoding, "crm"));
+	reg_array.MrsCrn = json_object_get_uint64(
+		json_object_object_get(mrs_encoding, "crn"));
+	reg_array.MrsOp1 = json_object_get_uint64(
+		json_object_object_get(mrs_encoding, "op1"));
+	reg_array.MrsO0 = json_object_get_uint64(
+		json_object_object_get(mrs_encoding, "o0"));
 
-    //Actual register value.
-    reg_array.Value = json_object_get_uint64(json_object_object_get(registers, "value"));
+	//Actual register value.
+	reg_array.Value = json_object_get_uint64(
+		json_object_object_get(registers, "value"));
 
-    //Flush to stream.
-    fwrite(&reg_array, sizeof(reg_array), 1, out);
-    fflush(out);
+	//Flush to stream.
+	fwrite(&reg_array, sizeof(reg_array), 1, out);
+	fflush(out);
 }
 
 //Converts a single ARM unknown register CPER-JSON object to CPER binary, outputting to the given stream.
-void ir_arm_unknown_register_to_cper(json_object* registers, EFI_ARM_CONTEXT_INFORMATION_HEADER* header, FILE* out)
+void ir_arm_unknown_register_to_cper(json_object *registers,
+				     EFI_ARM_CONTEXT_INFORMATION_HEADER *header,
+				     FILE *out)
 {
-    //Get base64 represented data.
-    json_object* encoded = json_object_object_get(registers, "data");
-    UINT8* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
+	//Get base64 represented data.
+	json_object *encoded = json_object_object_get(registers, "data");
+	UINT8 *decoded = b64_decode(json_object_get_string(encoded),
+				    json_object_get_string_len(encoded));
 
-    //Flush out to stream.
-    fwrite(&decoded, header->RegisterArraySize, 1, out);
-    fflush(out);
-    free(decoded);
+	//Flush out to stream.
+	fwrite(&decoded, header->RegisterArraySize, 1, out);
+	fflush(out);
+	free(decoded);
 }
\ No newline at end of file
diff --git a/sections/cper-section-ccix-per.c b/sections/cper-section-ccix-per.c
index d295017..5beebea 100644
--- a/sections/cper-section-ccix-per.c
+++ b/sections/cper-section-ccix-per.c
@@ -13,64 +13,77 @@
 #include "cper-section-ccix-per.h"
 
 //Converts a single CCIX PER log CPER section into JSON IR.
-json_object* cper_section_ccix_per_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_ccix_per_to_ir(void *section,
+			    EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_CCIX_PER_LOG_DATA* ccix_error = (EFI_CCIX_PER_LOG_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_CCIX_PER_LOG_DATA *ccix_error = (EFI_CCIX_PER_LOG_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Length (bytes) for the entire structure.
-    json_object_object_add(section_ir, "length", json_object_new_uint64(ccix_error->Length));
+	//Length (bytes) for the entire structure.
+	json_object_object_add(section_ir, "length",
+			       json_object_new_uint64(ccix_error->Length));
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(ccix_error->ValidBits, 3, CCIX_PER_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation = bitfield_to_ir(
+		ccix_error->ValidBits, 3, CCIX_PER_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //CCIX source/port IDs.
-    json_object_object_add(section_ir, "ccixSourceID", json_object_new_int(ccix_error->CcixSourceId));
-    json_object_object_add(section_ir, "ccixPortID", json_object_new_int(ccix_error->CcixPortId));
-    
-    //CCIX PER Log.
-    //This is formatted as described in Section 7.3.2 of CCIX Base Specification (Rev 1.0).
-    unsigned char* cur_pos = (unsigned char*)(ccix_error + 1);
-    int remaining_length = ccix_error->Length - sizeof(EFI_CCIX_PER_LOG_DATA);
-    if (remaining_length > 0)
-    {
-        char* encoded = b64_encode(cur_pos, remaining_length);
-        json_object_object_add(section_ir, "ccixPERLog", json_object_new_string(encoded));
-        free(encoded);
-    }
+	//CCIX source/port IDs.
+	json_object_object_add(section_ir, "ccixSourceID",
+			       json_object_new_int(ccix_error->CcixSourceId));
+	json_object_object_add(section_ir, "ccixPortID",
+			       json_object_new_int(ccix_error->CcixPortId));
 
-    return section_ir;
+	//CCIX PER Log.
+	//This is formatted as described in Section 7.3.2 of CCIX Base Specification (Rev 1.0).
+	unsigned char *cur_pos = (unsigned char *)(ccix_error + 1);
+	int remaining_length =
+		ccix_error->Length - sizeof(EFI_CCIX_PER_LOG_DATA);
+	if (remaining_length > 0) {
+		char *encoded = b64_encode(cur_pos, remaining_length);
+		json_object_object_add(section_ir, "ccixPERLog",
+				       json_object_new_string(encoded));
+		free(encoded);
+	}
+
+	return section_ir;
 }
 
 //Converts a single CCIX PER CPER-JSON section into CPER binary, outputting to the given stream.
-void ir_section_ccix_per_to_cper(json_object* section, FILE* out)
+void ir_section_ccix_per_to_cper(json_object *section, FILE *out)
 {
-    EFI_CCIX_PER_LOG_DATA* section_cper =
-        (EFI_CCIX_PER_LOG_DATA*)calloc(1, sizeof(EFI_CCIX_PER_LOG_DATA));
+	EFI_CCIX_PER_LOG_DATA *section_cper = (EFI_CCIX_PER_LOG_DATA *)calloc(
+		1, sizeof(EFI_CCIX_PER_LOG_DATA));
 
-    //Length.
-    section_cper->Length = json_object_get_uint64(json_object_object_get(section, "length"));
+	//Length.
+	section_cper->Length = json_object_get_uint64(
+		json_object_object_get(section, "length"));
 
-    //Validation bits.
-    section_cper->ValidBits = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        3, CCIX_PER_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidBits = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 3,
+		CCIX_PER_ERROR_VALID_BITFIELD_NAMES);
 
-    //CCIX source/port IDs.
-    section_cper->CcixSourceId = (UINT8)json_object_get_int(json_object_object_get(section, "ccixSourceID"));
-    section_cper->CcixPortId = (UINT8)json_object_get_int(json_object_object_get(section, "ccixPortID"));
-    
-    //Write header out to stream.
-    fwrite(section_cper, sizeof(EFI_CCIX_PER_LOG_DATA), 1, out);
-    fflush(out);
+	//CCIX source/port IDs.
+	section_cper->CcixSourceId = (UINT8)json_object_get_int(
+		json_object_object_get(section, "ccixSourceID"));
+	section_cper->CcixPortId = (UINT8)json_object_get_int(
+		json_object_object_get(section, "ccixPortID"));
 
-    //Write CCIX PER log itself to stream.
-    json_object* encoded = json_object_object_get(section, "ccixPERLog");
-    UINT8* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    fwrite(decoded, section_cper->Length - sizeof(EFI_CCIX_PER_LOG_DATA), 1, out);
-    fflush(out);
+	//Write header out to stream.
+	fwrite(section_cper, sizeof(EFI_CCIX_PER_LOG_DATA), 1, out);
+	fflush(out);
 
-    //Free resources.
-    free(decoded);
-    free(section_cper);
+	//Write CCIX PER log itself to stream.
+	json_object *encoded = json_object_object_get(section, "ccixPERLog");
+	UINT8 *decoded = b64_decode(json_object_get_string(encoded),
+				    json_object_get_string_len(encoded));
+	fwrite(decoded, section_cper->Length - sizeof(EFI_CCIX_PER_LOG_DATA), 1,
+	       out);
+	fflush(out);
+
+	//Free resources.
+	free(decoded);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-cxl-component.c b/sections/cper-section-cxl-component.c
index 15454a2..a4a8dec 100644
--- a/sections/cper-section-cxl-component.c
+++ b/sections/cper-section-cxl-component.c
@@ -12,91 +12,122 @@
 #include "cper-section-cxl-component.h"
 
 //Converts a single CXL component error CPER section into JSON IR.
-json_object* cper_section_cxl_component_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_cxl_component_to_ir(void *section,
+				 EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_CXL_COMPONENT_EVENT_HEADER* cxl_error = (EFI_CXL_COMPONENT_EVENT_HEADER*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_CXL_COMPONENT_EVENT_HEADER *cxl_error =
+		(EFI_CXL_COMPONENT_EVENT_HEADER *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Length (bytes) for the entire structure.
-    json_object_object_add(section_ir, "length", json_object_new_uint64(cxl_error->Length));
-    
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(cxl_error->ValidBits, 3, CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Length (bytes) for the entire structure.
+	json_object_object_add(section_ir, "length",
+			       json_object_new_uint64(cxl_error->Length));
 
-    //Device ID.
-    json_object* device_id = json_object_new_object();
-    json_object_object_add(device_id, "vendorID", json_object_new_int(cxl_error->DeviceId.VendorId));
-    json_object_object_add(device_id, "deviceID", json_object_new_int(cxl_error->DeviceId.DeviceId));
-    json_object_object_add(device_id, "functionNumber", json_object_new_int(cxl_error->DeviceId.FunctionNumber));
-    json_object_object_add(device_id, "deviceNumber", json_object_new_int(cxl_error->DeviceId.DeviceNumber));
-    json_object_object_add(device_id, "busNumber", json_object_new_int(cxl_error->DeviceId.BusNumber));
-    json_object_object_add(device_id, "segmentNumber", json_object_new_int(cxl_error->DeviceId.SegmentNumber));
-    json_object_object_add(device_id, "slotNumber", json_object_new_int(cxl_error->DeviceId.SlotNumber));
-    json_object_object_add(section_ir, "deviceID", device_id);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(cxl_error->ValidBits, 3,
+			       CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Device serial.
-    json_object_object_add(section_ir, "deviceSerial", json_object_new_uint64(cxl_error->DeviceSerial));
+	//Device ID.
+	json_object *device_id = json_object_new_object();
+	json_object_object_add(
+		device_id, "vendorID",
+		json_object_new_int(cxl_error->DeviceId.VendorId));
+	json_object_object_add(
+		device_id, "deviceID",
+		json_object_new_int(cxl_error->DeviceId.DeviceId));
+	json_object_object_add(
+		device_id, "functionNumber",
+		json_object_new_int(cxl_error->DeviceId.FunctionNumber));
+	json_object_object_add(
+		device_id, "deviceNumber",
+		json_object_new_int(cxl_error->DeviceId.DeviceNumber));
+	json_object_object_add(
+		device_id, "busNumber",
+		json_object_new_int(cxl_error->DeviceId.BusNumber));
+	json_object_object_add(
+		device_id, "segmentNumber",
+		json_object_new_int(cxl_error->DeviceId.SegmentNumber));
+	json_object_object_add(
+		device_id, "slotNumber",
+		json_object_new_int(cxl_error->DeviceId.SlotNumber));
+	json_object_object_add(section_ir, "deviceID", device_id);
 
-    //The specification for this is defined within the CXL Specification Section 8.2.9.1.
-    unsigned char* cur_pos = (unsigned char*)(cxl_error + 1);
-    int remaining_len = cxl_error->Length - sizeof(cxl_error);
-    if (remaining_len > 0)
-    {
-        json_object* event_log = json_object_new_object();
-        char* encoded = b64_encode(cur_pos, remaining_len);
-        json_object_object_add(event_log, "data", json_object_new_string(encoded));
-        free(encoded);
-        json_object_object_add(section_ir, "cxlComponentEventLog", event_log);
-    }
+	//Device serial.
+	json_object_object_add(section_ir, "deviceSerial",
+			       json_object_new_uint64(cxl_error->DeviceSerial));
 
-    return section_ir;
+	//The specification for this is defined within the CXL Specification Section 8.2.9.1.
+	unsigned char *cur_pos = (unsigned char *)(cxl_error + 1);
+	int remaining_len = cxl_error->Length - sizeof(cxl_error);
+	if (remaining_len > 0) {
+		json_object *event_log = json_object_new_object();
+		char *encoded = b64_encode(cur_pos, remaining_len);
+		json_object_object_add(event_log, "data",
+				       json_object_new_string(encoded));
+		free(encoded);
+		json_object_object_add(section_ir, "cxlComponentEventLog",
+				       event_log);
+	}
+
+	return section_ir;
 }
 
 //Converts a single given CXL Component CPER-JSON section into CPER binary, outputting to the
 //given stream.
-void ir_section_cxl_component_to_cper(json_object* section, FILE* out)
+void ir_section_cxl_component_to_cper(json_object *section, FILE *out)
 {
-    EFI_CXL_COMPONENT_EVENT_HEADER* section_cper =
-        (EFI_CXL_COMPONENT_EVENT_HEADER*)calloc(1, sizeof(EFI_CXL_COMPONENT_EVENT_HEADER));
+	EFI_CXL_COMPONENT_EVENT_HEADER *section_cper =
+		(EFI_CXL_COMPONENT_EVENT_HEADER *)calloc(
+			1, sizeof(EFI_CXL_COMPONENT_EVENT_HEADER));
 
-    //Length of the structure.
-    section_cper->Length = json_object_get_uint64(json_object_object_get(section, "length"));
+	//Length of the structure.
+	section_cper->Length = json_object_get_uint64(
+		json_object_object_get(section, "length"));
 
-    //Validation bits.
-    section_cper->ValidBits = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        3, CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidBits = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 3,
+		CXL_COMPONENT_ERROR_VALID_BITFIELD_NAMES);
 
-    //Device ID information.
-    json_object* device_id = json_object_object_get(section, "deviceID");
-    section_cper->DeviceId.VendorId = json_object_get_uint64(json_object_object_get(device_id, "vendorID"));
-    section_cper->DeviceId.DeviceId = json_object_get_uint64(json_object_object_get(device_id, "deviceID"));
-    section_cper->DeviceId.FunctionNumber = 
-        json_object_get_uint64(json_object_object_get(device_id, "functionNumber"));
-    section_cper->DeviceId.DeviceNumber = 
-        json_object_get_uint64(json_object_object_get(device_id, "deviceNumber"));
-    section_cper->DeviceId.BusNumber = 
-        json_object_get_uint64(json_object_object_get(device_id, "busNumber"));
-    section_cper->DeviceId.SegmentNumber = 
-        json_object_get_uint64(json_object_object_get(device_id, "segmentNumber"));
-    section_cper->DeviceId.SlotNumber = 
-        json_object_get_uint64(json_object_object_get(device_id, "slotNumber"));
+	//Device ID information.
+	json_object *device_id = json_object_object_get(section, "deviceID");
+	section_cper->DeviceId.VendorId = json_object_get_uint64(
+		json_object_object_get(device_id, "vendorID"));
+	section_cper->DeviceId.DeviceId = json_object_get_uint64(
+		json_object_object_get(device_id, "deviceID"));
+	section_cper->DeviceId.FunctionNumber = json_object_get_uint64(
+		json_object_object_get(device_id, "functionNumber"));
+	section_cper->DeviceId.DeviceNumber = json_object_get_uint64(
+		json_object_object_get(device_id, "deviceNumber"));
+	section_cper->DeviceId.BusNumber = json_object_get_uint64(
+		json_object_object_get(device_id, "busNumber"));
+	section_cper->DeviceId.SegmentNumber = json_object_get_uint64(
+		json_object_object_get(device_id, "segmentNumber"));
+	section_cper->DeviceId.SlotNumber = json_object_get_uint64(
+		json_object_object_get(device_id, "slotNumber"));
 
-    //Device serial number.
-    section_cper->DeviceSerial = json_object_get_uint64(json_object_object_get(section, "deviceSerial"));
+	//Device serial number.
+	section_cper->DeviceSerial = json_object_get_uint64(
+		json_object_object_get(section, "deviceSerial"));
 
-    //Write header out to stream.
-    fwrite(section_cper, sizeof(EFI_CXL_COMPONENT_EVENT_HEADER), 1, out);
-    fflush(out);
+	//Write header out to stream.
+	fwrite(section_cper, sizeof(EFI_CXL_COMPONENT_EVENT_HEADER), 1, out);
+	fflush(out);
 
-    //CXL component event log, decoded from base64.
-    json_object* event_log = json_object_object_get(section, "cxlComponentEventLog");
-    json_object* encoded = json_object_object_get(event_log, "data");
-    int log_length = section_cper->Length - sizeof(EFI_CXL_COMPONENT_EVENT_HEADER);
-    char* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    fwrite(decoded, log_length, 1, out);
-    fflush(out);
-    free(decoded);
+	//CXL component event log, decoded from base64.
+	json_object *event_log =
+		json_object_object_get(section, "cxlComponentEventLog");
+	json_object *encoded = json_object_object_get(event_log, "data");
+	int log_length =
+		section_cper->Length - sizeof(EFI_CXL_COMPONENT_EVENT_HEADER);
+	char *decoded = b64_decode(json_object_get_string(encoded),
+				   json_object_get_string_len(encoded));
+	fwrite(decoded, log_length, 1, out);
+	fflush(out);
+	free(decoded);
 
-    free(section_cper);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-cxl-protocol.c b/sections/cper-section-cxl-protocol.c
index b3334a3..43c9dd0 100644
--- a/sections/cper-section-cxl-protocol.c
+++ b/sections/cper-section-cxl-protocol.c
@@ -13,172 +13,231 @@
 #include "cper-section-cxl-protocol.h"
 
 //Converts a single CXL protocol error CPER section into JSON IR.
-json_object* cper_section_cxl_protocol_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_cxl_protocol_to_ir(void *section,
+				EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_CXL_PROTOCOL_ERROR_DATA* cxl_protocol_error = (EFI_CXL_PROTOCOL_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_CXL_PROTOCOL_ERROR_DATA *cxl_protocol_error =
+		(EFI_CXL_PROTOCOL_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(cxl_protocol_error->ValidBits, 7, CXL_PROTOCOL_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(cxl_protocol_error->ValidBits, 7,
+			       CXL_PROTOCOL_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Type of detecting agent.
-    json_object* agent_type = integer_to_readable_pair(cxl_protocol_error->CxlAgentType, 2,
-        CXL_PROTOCOL_ERROR_AGENT_TYPES_KEYS,
-        CXL_PROTOCOL_ERROR_AGENT_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "agentType", agent_type);
+	//Type of detecting agent.
+	json_object *agent_type = integer_to_readable_pair(
+		cxl_protocol_error->CxlAgentType, 2,
+		CXL_PROTOCOL_ERROR_AGENT_TYPES_KEYS,
+		CXL_PROTOCOL_ERROR_AGENT_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "agentType", agent_type);
 
-    //CXL agent address, depending on the agent type.
-    json_object* agent_address = json_object_new_object();
-    if (cxl_protocol_error->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT)
-    {
-        //Address is a CXL1.1 device agent.
-        json_object_object_add(agent_address, "functionNumber", 
-            json_object_new_uint64(cxl_protocol_error->CxlAgentAddress.DeviceAddress.FunctionNumber));
-        json_object_object_add(agent_address, "deviceNumber", 
-            json_object_new_uint64(cxl_protocol_error->CxlAgentAddress.DeviceAddress.DeviceNumber));
-        json_object_object_add(agent_address, "busNumber", 
-            json_object_new_uint64(cxl_protocol_error->CxlAgentAddress.DeviceAddress.BusNumber));
-        json_object_object_add(agent_address, "segmentNumber", 
-            json_object_new_uint64(cxl_protocol_error->CxlAgentAddress.DeviceAddress.SegmentNumber));
-    }
-    else if (cxl_protocol_error->CxlAgentType == CXL_PROTOCOL_ERROR_HOST_DOWNSTREAM_PORT_AGENT)
-    {
-        //Address is a CXL port RCRB base address.
-        json_object_object_add(agent_address, "value", 
-            json_object_new_uint64(cxl_protocol_error->CxlAgentAddress.PortRcrbBaseAddress));
-    }
-    json_object_object_add(section_ir, "cxlAgentAddress", agent_address);
+	//CXL agent address, depending on the agent type.
+	json_object *agent_address = json_object_new_object();
+	if (cxl_protocol_error->CxlAgentType ==
+	    CXL_PROTOCOL_ERROR_DEVICE_AGENT) {
+		//Address is a CXL1.1 device agent.
+		json_object_object_add(
+			agent_address, "functionNumber",
+			json_object_new_uint64(
+				cxl_protocol_error->CxlAgentAddress
+					.DeviceAddress.FunctionNumber));
+		json_object_object_add(
+			agent_address, "deviceNumber",
+			json_object_new_uint64(
+				cxl_protocol_error->CxlAgentAddress
+					.DeviceAddress.DeviceNumber));
+		json_object_object_add(
+			agent_address, "busNumber",
+			json_object_new_uint64(
+				cxl_protocol_error->CxlAgentAddress
+					.DeviceAddress.BusNumber));
+		json_object_object_add(
+			agent_address, "segmentNumber",
+			json_object_new_uint64(
+				cxl_protocol_error->CxlAgentAddress
+					.DeviceAddress.SegmentNumber));
+	} else if (cxl_protocol_error->CxlAgentType ==
+		   CXL_PROTOCOL_ERROR_HOST_DOWNSTREAM_PORT_AGENT) {
+		//Address is a CXL port RCRB base address.
+		json_object_object_add(
+			agent_address, "value",
+			json_object_new_uint64(
+				cxl_protocol_error->CxlAgentAddress
+					.PortRcrbBaseAddress));
+	}
+	json_object_object_add(section_ir, "cxlAgentAddress", agent_address);
 
-    //Device ID.
-    json_object* device_id = json_object_new_object();
-    json_object_object_add(device_id, "vendorID", 
-        json_object_new_uint64(cxl_protocol_error->DeviceId.VendorId));
-    json_object_object_add(device_id, "deviceID", 
-        json_object_new_uint64(cxl_protocol_error->DeviceId.DeviceId));
-    json_object_object_add(device_id, "subsystemVendorID", 
-        json_object_new_uint64(cxl_protocol_error->DeviceId.SubsystemVendorId));
-    json_object_object_add(device_id, "subsystemDeviceID", 
-        json_object_new_uint64(cxl_protocol_error->DeviceId.SubsystemDeviceId));
-    json_object_object_add(device_id, "classCode", 
-        json_object_new_uint64(cxl_protocol_error->DeviceId.ClassCode));
-    json_object_object_add(device_id, "slotNumber", 
-        json_object_new_uint64(cxl_protocol_error->DeviceId.SlotNumber));
-    json_object_object_add(section_ir, "deviceID", device_id);
+	//Device ID.
+	json_object *device_id = json_object_new_object();
+	json_object_object_add(
+		device_id, "vendorID",
+		json_object_new_uint64(cxl_protocol_error->DeviceId.VendorId));
+	json_object_object_add(
+		device_id, "deviceID",
+		json_object_new_uint64(cxl_protocol_error->DeviceId.DeviceId));
+	json_object_object_add(
+		device_id, "subsystemVendorID",
+		json_object_new_uint64(
+			cxl_protocol_error->DeviceId.SubsystemVendorId));
+	json_object_object_add(
+		device_id, "subsystemDeviceID",
+		json_object_new_uint64(
+			cxl_protocol_error->DeviceId.SubsystemDeviceId));
+	json_object_object_add(
+		device_id, "classCode",
+		json_object_new_uint64(cxl_protocol_error->DeviceId.ClassCode));
+	json_object_object_add(
+		device_id, "slotNumber",
+		json_object_new_uint64(
+			cxl_protocol_error->DeviceId.SlotNumber));
+	json_object_object_add(section_ir, "deviceID", device_id);
 
-    //Device serial & capability structure (if CXL 1.1 device).
-    if (cxl_protocol_error->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT)
-    {
-        json_object_object_add(section_ir, "deviceSerial", json_object_new_uint64(cxl_protocol_error->DeviceSerial));
+	//Device serial & capability structure (if CXL 1.1 device).
+	if (cxl_protocol_error->CxlAgentType ==
+	    CXL_PROTOCOL_ERROR_DEVICE_AGENT) {
+		json_object_object_add(
+			section_ir, "deviceSerial",
+			json_object_new_uint64(
+				cxl_protocol_error->DeviceSerial));
 
-        //The PCIe capability structure provided here could either be PCIe 1.1 Capability Structure 
-        //(36-byte, padded to 60 bytes) or PCIe 2.0 Capability Structure (60-byte). There does not seem
-        //to be a way to differentiate these, so this is left as a b64 dump.
-        char* encoded = b64_encode(cxl_protocol_error->CapabilityStructure.PcieCap, 60);
-        json_object_object_add(section_ir, "capabilityStructure", json_object_new_string(encoded));
-        free(encoded);
-    }
+		//The PCIe capability structure provided here could either be PCIe 1.1 Capability Structure
+		//(36-byte, padded to 60 bytes) or PCIe 2.0 Capability Structure (60-byte). There does not seem
+		//to be a way to differentiate these, so this is left as a b64 dump.
+		char *encoded = b64_encode(
+			cxl_protocol_error->CapabilityStructure.PcieCap, 60);
+		json_object_object_add(section_ir, "capabilityStructure",
+				       json_object_new_string(encoded));
+		free(encoded);
+	}
 
-    //CXL DVSEC & error log length.
-    json_object_object_add(section_ir, "dvsecLength", json_object_new_int(cxl_protocol_error->CxlDvsecLength));
-    json_object_object_add(section_ir, "errorLogLength", json_object_new_int(cxl_protocol_error->CxlErrorLogLength));
+	//CXL DVSEC & error log length.
+	json_object_object_add(
+		section_ir, "dvsecLength",
+		json_object_new_int(cxl_protocol_error->CxlDvsecLength));
+	json_object_object_add(
+		section_ir, "errorLogLength",
+		json_object_new_int(cxl_protocol_error->CxlErrorLogLength));
 
-    //CXL DVSEC
-    //For CXL 1.1 devices, this is the "CXL DVSEC For Flex Bus Device" structure as in CXL 1.1 spec.
-    //For CXL 1.1 host downstream ports, this is the "CXL DVSEC For Flex Bus Port" structure as in CXL 1.1 spec.
-    unsigned char* cur_pos = (unsigned char*)(cxl_protocol_error + 1);
-    char* encoded = b64_encode(cur_pos, cxl_protocol_error->CxlDvsecLength);
-    json_object_object_add(section_ir, "cxlDVSEC", json_object_new_string(encoded));
-    free(encoded);
-    cur_pos += cxl_protocol_error->CxlDvsecLength;
+	//CXL DVSEC
+	//For CXL 1.1 devices, this is the "CXL DVSEC For Flex Bus Device" structure as in CXL 1.1 spec.
+	//For CXL 1.1 host downstream ports, this is the "CXL DVSEC For Flex Bus Port" structure as in CXL 1.1 spec.
+	unsigned char *cur_pos = (unsigned char *)(cxl_protocol_error + 1);
+	char *encoded = b64_encode(cur_pos, cxl_protocol_error->CxlDvsecLength);
+	json_object_object_add(section_ir, "cxlDVSEC",
+			       json_object_new_string(encoded));
+	free(encoded);
+	cur_pos += cxl_protocol_error->CxlDvsecLength;
 
-    //CXL Error Log
-    //This is the "CXL RAS Capability Structure" as in CXL 1.1 spec.
-    encoded = b64_encode(cur_pos, cxl_protocol_error->CxlErrorLogLength);
-    json_object_object_add(section_ir, "cxlErrorLog", json_object_new_string(encoded));
-    free(encoded);
-    
-    return section_ir;
+	//CXL Error Log
+	//This is the "CXL RAS Capability Structure" as in CXL 1.1 spec.
+	encoded = b64_encode(cur_pos, cxl_protocol_error->CxlErrorLogLength);
+	json_object_object_add(section_ir, "cxlErrorLog",
+			       json_object_new_string(encoded));
+	free(encoded);
+
+	return section_ir;
 }
 
 //Converts a single CXL protocol CPER-JSON section into CPER binary, outputting to the given stream.
-void ir_section_cxl_protocol_to_cper(json_object* section, FILE* out)
+void ir_section_cxl_protocol_to_cper(json_object *section, FILE *out)
 {
-    EFI_CXL_PROTOCOL_ERROR_DATA* section_cper =
-        (EFI_CXL_PROTOCOL_ERROR_DATA*)calloc(1, sizeof(EFI_CXL_PROTOCOL_ERROR_DATA));
-        
-    //Validation bits.
-    section_cper->ValidBits = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        7, CXL_PROTOCOL_ERROR_VALID_BITFIELD_NAMES);
+	EFI_CXL_PROTOCOL_ERROR_DATA *section_cper =
+		(EFI_CXL_PROTOCOL_ERROR_DATA *)calloc(
+			1, sizeof(EFI_CXL_PROTOCOL_ERROR_DATA));
 
-    //Detecting agent type.
-    section_cper->CxlAgentType = readable_pair_to_integer(json_object_object_get(section, "agentType"));
+	//Validation bits.
+	section_cper->ValidBits = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 7,
+		CXL_PROTOCOL_ERROR_VALID_BITFIELD_NAMES);
 
-    //Based on the agent type, set the address.
-    json_object* address = json_object_object_get(section, "cxlAgentAddress");
-    if (section_cper->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT)
-    {
-        //Address is split by function, device, bus & segment.
-        UINT64 function = json_object_get_uint64(json_object_object_get(address, "functionNumber"));
-        UINT64 device = json_object_get_uint64(json_object_object_get(address, "deviceNumber"));
-        UINT64 bus = json_object_get_uint64(json_object_object_get(address, "busNumber"));
-        UINT64 segment = json_object_get_uint64(json_object_object_get(address, "segmentNumber"));
-        section_cper->CxlAgentAddress.DeviceAddress.FunctionNumber = function;
-        section_cper->CxlAgentAddress.DeviceAddress.DeviceNumber = device;
-        section_cper->CxlAgentAddress.DeviceAddress.BusNumber = bus;
-        section_cper->CxlAgentAddress.DeviceAddress.SegmentNumber = segment;
-    }
-    else if (section_cper->CxlAgentType == CXL_PROTOCOL_ERROR_HOST_DOWNSTREAM_PORT_AGENT)
-    {
-        //Plain RCRB base address.
-        section_cper->CxlAgentAddress.PortRcrbBaseAddress = 
-            json_object_get_uint64(json_object_object_get(address, "value"));
-    }
+	//Detecting agent type.
+	section_cper->CxlAgentType = readable_pair_to_integer(
+		json_object_object_get(section, "agentType"));
 
-    //Device ID information.
-    json_object* device_id = json_object_object_get(section, "deviceID");
-    section_cper->DeviceId.VendorId = json_object_get_uint64(json_object_object_get(device_id, "vendorID"));
-    section_cper->DeviceId.DeviceId = json_object_get_uint64(json_object_object_get(device_id, "deviceID"));
-    section_cper->DeviceId.SubsystemVendorId = 
-        json_object_get_uint64(json_object_object_get(device_id, "subsystemVendorID"));
-    section_cper->DeviceId.SubsystemDeviceId = 
-        json_object_get_uint64(json_object_object_get(device_id, "subsystemDeviceID"));
-    section_cper->DeviceId.ClassCode = json_object_get_uint64(json_object_object_get(device_id, "classCode"));
-    section_cper->DeviceId.SlotNumber = json_object_get_uint64(json_object_object_get(device_id, "slotNumber"));
+	//Based on the agent type, set the address.
+	json_object *address =
+		json_object_object_get(section, "cxlAgentAddress");
+	if (section_cper->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT) {
+		//Address is split by function, device, bus & segment.
+		UINT64 function = json_object_get_uint64(
+			json_object_object_get(address, "functionNumber"));
+		UINT64 device = json_object_get_uint64(
+			json_object_object_get(address, "deviceNumber"));
+		UINT64 bus = json_object_get_uint64(
+			json_object_object_get(address, "busNumber"));
+		UINT64 segment = json_object_get_uint64(
+			json_object_object_get(address, "segmentNumber"));
+		section_cper->CxlAgentAddress.DeviceAddress.FunctionNumber =
+			function;
+		section_cper->CxlAgentAddress.DeviceAddress.DeviceNumber =
+			device;
+		section_cper->CxlAgentAddress.DeviceAddress.BusNumber = bus;
+		section_cper->CxlAgentAddress.DeviceAddress.SegmentNumber =
+			segment;
+	} else if (section_cper->CxlAgentType ==
+		   CXL_PROTOCOL_ERROR_HOST_DOWNSTREAM_PORT_AGENT) {
+		//Plain RCRB base address.
+		section_cper->CxlAgentAddress.PortRcrbBaseAddress =
+			json_object_get_uint64(
+				json_object_object_get(address, "value"));
+	}
 
-    //If CXL 1.1 device, the serial number & PCI capability structure.
-    if (section_cper->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT)
-    {
-        section_cper->DeviceSerial = json_object_get_uint64(json_object_object_get(section, "deviceSerial"));
+	//Device ID information.
+	json_object *device_id = json_object_object_get(section, "deviceID");
+	section_cper->DeviceId.VendorId = json_object_get_uint64(
+		json_object_object_get(device_id, "vendorID"));
+	section_cper->DeviceId.DeviceId = json_object_get_uint64(
+		json_object_object_get(device_id, "deviceID"));
+	section_cper->DeviceId.SubsystemVendorId = json_object_get_uint64(
+		json_object_object_get(device_id, "subsystemVendorID"));
+	section_cper->DeviceId.SubsystemDeviceId = json_object_get_uint64(
+		json_object_object_get(device_id, "subsystemDeviceID"));
+	section_cper->DeviceId.ClassCode = json_object_get_uint64(
+		json_object_object_get(device_id, "classCode"));
+	section_cper->DeviceId.SlotNumber = json_object_get_uint64(
+		json_object_object_get(device_id, "slotNumber"));
 
-        json_object* encoded = json_object_object_get(section, "capabilityStructure");
-        char* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-        memcpy(section_cper->CapabilityStructure.PcieCap, decoded, 60);
-        free(decoded);
-    }
+	//If CXL 1.1 device, the serial number & PCI capability structure.
+	if (section_cper->CxlAgentType == CXL_PROTOCOL_ERROR_DEVICE_AGENT) {
+		section_cper->DeviceSerial = json_object_get_uint64(
+			json_object_object_get(section, "deviceSerial"));
 
-    //DVSEC length & error log length.
-    section_cper->CxlDvsecLength = (UINT16)json_object_get_int(json_object_object_get(section, "dvsecLength"));
-    section_cper->CxlErrorLogLength = (UINT16)json_object_get_int(json_object_object_get(section, "errorLogLength"));
+		json_object *encoded =
+			json_object_object_get(section, "capabilityStructure");
+		char *decoded = b64_decode(json_object_get_string(encoded),
+					   json_object_get_string_len(encoded));
+		memcpy(section_cper->CapabilityStructure.PcieCap, decoded, 60);
+		free(decoded);
+	}
 
-    //Write header to stream.
-    fwrite(section_cper, sizeof(EFI_CXL_PROTOCOL_ERROR_DATA), 1, out);
-    fflush(out);
+	//DVSEC length & error log length.
+	section_cper->CxlDvsecLength = (UINT16)json_object_get_int(
+		json_object_object_get(section, "dvsecLength"));
+	section_cper->CxlErrorLogLength = (UINT16)json_object_get_int(
+		json_object_object_get(section, "errorLogLength"));
 
-    //DVSEC out to stream.
-    json_object* encoded = json_object_object_get(section, "cxlDVSEC");
-    char* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    fwrite(decoded, section_cper->CxlDvsecLength, 1, out);
-    fflush(out);
-    free(decoded);
+	//Write header to stream.
+	fwrite(section_cper, sizeof(EFI_CXL_PROTOCOL_ERROR_DATA), 1, out);
+	fflush(out);
 
-    //Error log out to stream.
-    encoded = json_object_object_get(section, "cxlErrorLog");
-    decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    fwrite(decoded, section_cper->CxlErrorLogLength, 1, out);
-    fflush(out);
-    free(decoded);
+	//DVSEC out to stream.
+	json_object *encoded = json_object_object_get(section, "cxlDVSEC");
+	char *decoded = b64_decode(json_object_get_string(encoded),
+				   json_object_get_string_len(encoded));
+	fwrite(decoded, section_cper->CxlDvsecLength, 1, out);
+	fflush(out);
+	free(decoded);
 
-    free(section_cper);
+	//Error log out to stream.
+	encoded = json_object_object_get(section, "cxlErrorLog");
+	decoded = b64_decode(json_object_get_string(encoded),
+			     json_object_get_string_len(encoded));
+	fwrite(decoded, section_cper->CxlErrorLogLength, 1, out);
+	fflush(out);
+	free(decoded);
+
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-dmar-generic.c b/sections/cper-section-dmar-generic.c
index faeefa8..420dd8d 100644
--- a/sections/cper-section-dmar-generic.c
+++ b/sections/cper-section-dmar-generic.c
@@ -11,67 +11,84 @@
 #include "cper-section-dmar-generic.h"
 
 //Converts a single generic DMAr CPER section into JSON IR.
-json_object* cper_section_dmar_generic_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_dmar_generic_to_ir(void *section,
+				EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_DMAR_GENERIC_ERROR_DATA* firmware_error = (EFI_DMAR_GENERIC_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_DMAR_GENERIC_ERROR_DATA *firmware_error =
+		(EFI_DMAR_GENERIC_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Requester ID, segment.
-    json_object_object_add(section_ir, "requesterID", json_object_new_int(firmware_error->RequesterId));
-    json_object_object_add(section_ir, "segmentNumber", json_object_new_int(firmware_error->SegmentNumber));
+	//Requester ID, segment.
+	json_object_object_add(
+		section_ir, "requesterID",
+		json_object_new_int(firmware_error->RequesterId));
+	json_object_object_add(
+		section_ir, "segmentNumber",
+		json_object_new_int(firmware_error->SegmentNumber));
 
-    //Fault reason.
-    json_object* fault_reason = integer_to_readable_pair_with_desc(firmware_error->FaultReason, 11,
-        DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_KEYS,
-        DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_VALUES,
-        DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_DESCRIPTIONS,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "faultReason", fault_reason);
+	//Fault reason.
+	json_object *fault_reason = integer_to_readable_pair_with_desc(
+		firmware_error->FaultReason, 11,
+		DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_KEYS,
+		DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_VALUES,
+		DMAR_GENERIC_ERROR_FAULT_REASON_TYPES_DESCRIPTIONS,
+		"Unknown (Reserved)");
+	json_object_object_add(section_ir, "faultReason", fault_reason);
 
-    //Access type.
-    json_object* access_type = integer_to_readable_pair(firmware_error->AccessType, 2,
-        DMAR_GENERIC_ERROR_ACCESS_TYPES_KEYS,
-        DMAR_GENERIC_ERROR_ACCESS_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "accessType", access_type);
+	//Access type.
+	json_object *access_type = integer_to_readable_pair(
+		firmware_error->AccessType, 2,
+		DMAR_GENERIC_ERROR_ACCESS_TYPES_KEYS,
+		DMAR_GENERIC_ERROR_ACCESS_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "accessType", access_type);
 
-    //Address type.
-    json_object* address_type = integer_to_readable_pair(firmware_error->AddressType, 2,
-        DMAR_GENERIC_ERROR_ADDRESS_TYPES_KEYS,
-        DMAR_GENERIC_ERROR_ADDRESS_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "addressType", address_type);
+	//Address type.
+	json_object *address_type = integer_to_readable_pair(
+		firmware_error->AddressType, 2,
+		DMAR_GENERIC_ERROR_ADDRESS_TYPES_KEYS,
+		DMAR_GENERIC_ERROR_ADDRESS_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "addressType", address_type);
 
-    //Architecture type.
-    json_object* arch_type = integer_to_readable_pair(firmware_error->ArchType, 2,
-        DMAR_GENERIC_ERROR_ARCH_TYPES_KEYS,
-        DMAR_GENERIC_ERROR_ARCH_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "architectureType", arch_type);
+	//Architecture type.
+	json_object *arch_type = integer_to_readable_pair(
+		firmware_error->ArchType, 2, DMAR_GENERIC_ERROR_ARCH_TYPES_KEYS,
+		DMAR_GENERIC_ERROR_ARCH_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "architectureType", arch_type);
 
-    //Device address.
-    json_object_object_add(section_ir, "deviceAddress", json_object_new_uint64(firmware_error->DeviceAddr));
-    
-    return section_ir;
+	//Device address.
+	json_object_object_add(
+		section_ir, "deviceAddress",
+		json_object_new_uint64(firmware_error->DeviceAddr));
+
+	return section_ir;
 }
 
 //Converts a single generic DMAR CPER-JSON section into CPER binary, outputting to the given stream.
-void ir_section_dmar_generic_to_cper(json_object* section, FILE* out)
+void ir_section_dmar_generic_to_cper(json_object *section, FILE *out)
 {
-    EFI_DMAR_GENERIC_ERROR_DATA* section_cper =
-        (EFI_DMAR_GENERIC_ERROR_DATA*)calloc(1, sizeof(EFI_DMAR_GENERIC_ERROR_DATA));
+	EFI_DMAR_GENERIC_ERROR_DATA *section_cper =
+		(EFI_DMAR_GENERIC_ERROR_DATA *)calloc(
+			1, sizeof(EFI_DMAR_GENERIC_ERROR_DATA));
 
-    //Record fields.
-    section_cper->RequesterId = (UINT16)json_object_get_int(json_object_object_get(section, "requesterID"));
-    section_cper->SegmentNumber = (UINT16)json_object_get_int(json_object_object_get(section, "segmentNumber"));
-    section_cper->FaultReason = (UINT8)readable_pair_to_integer(json_object_object_get(section, "faultReason"));
-    section_cper->AccessType = (UINT8)readable_pair_to_integer(json_object_object_get(section, "accessType"));
-    section_cper->AddressType = (UINT8)readable_pair_to_integer(json_object_object_get(section, "addressType"));
-    section_cper->ArchType = (UINT8)readable_pair_to_integer(json_object_object_get(section, "architectureType"));
-    section_cper->DeviceAddr = json_object_get_uint64(json_object_object_get(section, "deviceAddress"));
+	//Record fields.
+	section_cper->RequesterId = (UINT16)json_object_get_int(
+		json_object_object_get(section, "requesterID"));
+	section_cper->SegmentNumber = (UINT16)json_object_get_int(
+		json_object_object_get(section, "segmentNumber"));
+	section_cper->FaultReason = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "faultReason"));
+	section_cper->AccessType = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "accessType"));
+	section_cper->AddressType = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "addressType"));
+	section_cper->ArchType = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "architectureType"));
+	section_cper->DeviceAddr = json_object_get_uint64(
+		json_object_object_get(section, "deviceAddress"));
 
-    //Write to stream, free resources.
-    fwrite(section_cper, sizeof(EFI_DMAR_GENERIC_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write to stream, free resources.
+	fwrite(section_cper, sizeof(EFI_DMAR_GENERIC_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-dmar-iommu.c b/sections/cper-section-dmar-iommu.c
index 2861053..0c8df4a 100644
--- a/sections/cper-section-dmar-iommu.c
+++ b/sections/cper-section-dmar-iommu.c
@@ -13,73 +13,101 @@
 #include "cper-section-dmar-iommu.h"
 
 //Converts a single IOMMU specific DMAr CPER section into JSON IR.
-json_object* cper_section_dmar_iommu_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_dmar_iommu_to_ir(void *section,
+			      EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_IOMMU_DMAR_ERROR_DATA* iommu_error = (EFI_IOMMU_DMAR_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_IOMMU_DMAR_ERROR_DATA *iommu_error =
+		(EFI_IOMMU_DMAR_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Revision.
-    json_object_object_add(section_ir, "revision", json_object_new_int(iommu_error->Revision));
+	//Revision.
+	json_object_object_add(section_ir, "revision",
+			       json_object_new_int(iommu_error->Revision));
 
-    //IOMMU registers.
-    json_object_object_add(section_ir, "controlRegister", json_object_new_uint64(iommu_error->Control));
-    json_object_object_add(section_ir, "statusRegister", json_object_new_uint64(iommu_error->Status));
+	//IOMMU registers.
+	json_object_object_add(section_ir, "controlRegister",
+			       json_object_new_uint64(iommu_error->Control));
+	json_object_object_add(section_ir, "statusRegister",
+			       json_object_new_uint64(iommu_error->Status));
 
-    //IOMMU event log entry.
-    //The format of these entries differ widely by the type of error.
-    char* encoded = b64_encode((unsigned char*)iommu_error->EventLogEntry, 16);
-    json_object_object_add(section_ir, "eventLogEntry", json_object_new_string(encoded));
-    free(encoded);
+	//IOMMU event log entry.
+	//The format of these entries differ widely by the type of error.
+	char *encoded =
+		b64_encode((unsigned char *)iommu_error->EventLogEntry, 16);
+	json_object_object_add(section_ir, "eventLogEntry",
+			       json_object_new_string(encoded));
+	free(encoded);
 
-    //Device table entry (as base64).
-    encoded = b64_encode((unsigned char*)iommu_error->DeviceTableEntry, 32);
-    json_object_object_add(section_ir, "deviceTableEntry", json_object_new_string(encoded));
-    free(encoded);
+	//Device table entry (as base64).
+	encoded =
+		b64_encode((unsigned char *)iommu_error->DeviceTableEntry, 32);
+	json_object_object_add(section_ir, "deviceTableEntry",
+			       json_object_new_string(encoded));
+	free(encoded);
 
-    //Page table entries.
-    json_object_object_add(section_ir, "pageTableEntry_Level6", json_object_new_uint64(iommu_error->PteL6));
-    json_object_object_add(section_ir, "pageTableEntry_Level5", json_object_new_uint64(iommu_error->PteL5));
-    json_object_object_add(section_ir, "pageTableEntry_Level4", json_object_new_uint64(iommu_error->PteL4));
-    json_object_object_add(section_ir, "pageTableEntry_Level3", json_object_new_uint64(iommu_error->PteL3));
-    json_object_object_add(section_ir, "pageTableEntry_Level2", json_object_new_uint64(iommu_error->PteL2));
-    json_object_object_add(section_ir, "pageTableEntry_Level1", json_object_new_uint64(iommu_error->PteL1));
+	//Page table entries.
+	json_object_object_add(section_ir, "pageTableEntry_Level6",
+			       json_object_new_uint64(iommu_error->PteL6));
+	json_object_object_add(section_ir, "pageTableEntry_Level5",
+			       json_object_new_uint64(iommu_error->PteL5));
+	json_object_object_add(section_ir, "pageTableEntry_Level4",
+			       json_object_new_uint64(iommu_error->PteL4));
+	json_object_object_add(section_ir, "pageTableEntry_Level3",
+			       json_object_new_uint64(iommu_error->PteL3));
+	json_object_object_add(section_ir, "pageTableEntry_Level2",
+			       json_object_new_uint64(iommu_error->PteL2));
+	json_object_object_add(section_ir, "pageTableEntry_Level1",
+			       json_object_new_uint64(iommu_error->PteL1));
 
-    return section_ir;
+	return section_ir;
 }
 
 //Converts a single DMAR IOMMU CPER-JSON section into CPER binary, outputting to the given stream.
-void ir_section_dmar_iommu_to_cper(json_object* section, FILE* out)
+void ir_section_dmar_iommu_to_cper(json_object *section, FILE *out)
 {
-    EFI_IOMMU_DMAR_ERROR_DATA* section_cper =
-        (EFI_IOMMU_DMAR_ERROR_DATA*)calloc(1, sizeof(EFI_IOMMU_DMAR_ERROR_DATA));
+	EFI_IOMMU_DMAR_ERROR_DATA *section_cper =
+		(EFI_IOMMU_DMAR_ERROR_DATA *)calloc(
+			1, sizeof(EFI_IOMMU_DMAR_ERROR_DATA));
 
-    //Revision, registers.
-    section_cper->Revision = (UINT8)json_object_get_int(json_object_object_get(section, "revision"));
-    section_cper->Control = json_object_get_uint64(json_object_object_get(section, "controlRegister"));
-    section_cper->Status = json_object_get_uint64(json_object_object_get(section, "statusRegister"));
+	//Revision, registers.
+	section_cper->Revision = (UINT8)json_object_get_int(
+		json_object_object_get(section, "revision"));
+	section_cper->Control = json_object_get_uint64(
+		json_object_object_get(section, "controlRegister"));
+	section_cper->Status = json_object_get_uint64(
+		json_object_object_get(section, "statusRegister"));
 
-    //IOMMU event log entry.
-    json_object* encoded = json_object_object_get(section, "eventLogEntry");
-    UINT8* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    memcpy(section_cper->EventLogEntry, decoded, 16);
-    free(decoded);
+	//IOMMU event log entry.
+	json_object *encoded = json_object_object_get(section, "eventLogEntry");
+	UINT8 *decoded = b64_decode(json_object_get_string(encoded),
+				    json_object_get_string_len(encoded));
+	memcpy(section_cper->EventLogEntry, decoded, 16);
+	free(decoded);
 
-    //Device table entry.
-    encoded = json_object_object_get(section, "deviceTableEntry");
-    decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    memcpy(section_cper->DeviceTableEntry, decoded, 32);
-    free(decoded);
+	//Device table entry.
+	encoded = json_object_object_get(section, "deviceTableEntry");
+	decoded = b64_decode(json_object_get_string(encoded),
+			     json_object_get_string_len(encoded));
+	memcpy(section_cper->DeviceTableEntry, decoded, 32);
+	free(decoded);
 
-    //Page table entries.
-    section_cper->PteL1 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level1"));
-    section_cper->PteL2 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level2"));
-    section_cper->PteL3 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level3"));
-    section_cper->PteL4 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level4"));
-    section_cper->PteL5 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level5"));
-    section_cper->PteL6 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level6"));
+	//Page table entries.
+	section_cper->PteL1 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level1"));
+	section_cper->PteL2 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level2"));
+	section_cper->PteL3 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level3"));
+	section_cper->PteL4 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level4"));
+	section_cper->PteL5 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level5"));
+	section_cper->PteL6 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level6"));
 
-    //Write to stream, free resources.
-    fwrite(section_cper, sizeof(EFI_IOMMU_DMAR_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write to stream, free resources.
+	fwrite(section_cper, sizeof(EFI_IOMMU_DMAR_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-dmar-vtd.c b/sections/cper-section-dmar-vtd.c
index cfaace7..73fb2fc 100644
--- a/sections/cper-section-dmar-vtd.c
+++ b/sections/cper-section-dmar-vtd.c
@@ -13,133 +13,188 @@
 #include "cper-section-dmar-vtd.h"
 
 //Converts a single VT-d specific DMAr CPER section into JSON IR.
-json_object* cper_section_dmar_vtd_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_dmar_vtd_to_ir(void *section,
+			    EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_DIRECTED_IO_DMAR_ERROR_DATA* vtd_error = (EFI_DIRECTED_IO_DMAR_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_DIRECTED_IO_DMAR_ERROR_DATA *vtd_error =
+		(EFI_DIRECTED_IO_DMAR_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Version, revision and OEM ID, as defined in the VT-d architecture.
-    UINT64 oem_id = 0;
-    for (int i=0; i<6; i++)
-        oem_id |= (UINT64)vtd_error->OemId[i] << (i * 8);
-    json_object_object_add(section_ir, "version", json_object_new_int(vtd_error->Version));
-    json_object_object_add(section_ir, "revision", json_object_new_int(vtd_error->Revision));
-    json_object_object_add(section_ir, "oemID", json_object_new_uint64(oem_id));
+	//Version, revision and OEM ID, as defined in the VT-d architecture.
+	UINT64 oem_id = 0;
+	for (int i = 0; i < 6; i++)
+		oem_id |= (UINT64)vtd_error->OemId[i] << (i * 8);
+	json_object_object_add(section_ir, "version",
+			       json_object_new_int(vtd_error->Version));
+	json_object_object_add(section_ir, "revision",
+			       json_object_new_int(vtd_error->Revision));
+	json_object_object_add(section_ir, "oemID",
+			       json_object_new_uint64(oem_id));
 
-    //Registers.
-    json_object_object_add(section_ir, "capabilityRegister", json_object_new_uint64(vtd_error->Capability));
-    json_object_object_add(section_ir, "extendedCapabilityRegister", json_object_new_uint64(vtd_error->CapabilityEx));
-    json_object_object_add(section_ir, "globalCommandRegister", json_object_new_uint64(vtd_error->GlobalCommand));
-    json_object_object_add(section_ir, "globalStatusRegister", json_object_new_uint64(vtd_error->GlobalStatus));
-    json_object_object_add(section_ir, "faultStatusRegister", json_object_new_uint64(vtd_error->FaultStatus));
+	//Registers.
+	json_object_object_add(section_ir, "capabilityRegister",
+			       json_object_new_uint64(vtd_error->Capability));
+	json_object_object_add(section_ir, "extendedCapabilityRegister",
+			       json_object_new_uint64(vtd_error->CapabilityEx));
+	json_object_object_add(
+		section_ir, "globalCommandRegister",
+		json_object_new_uint64(vtd_error->GlobalCommand));
+	json_object_object_add(section_ir, "globalStatusRegister",
+			       json_object_new_uint64(vtd_error->GlobalStatus));
+	json_object_object_add(section_ir, "faultStatusRegister",
+			       json_object_new_uint64(vtd_error->FaultStatus));
 
-    //Fault record basic fields.
-    json_object* fault_record_ir = json_object_new_object();
-    EFI_VTD_FAULT_RECORD* fault_record = (EFI_VTD_FAULT_RECORD*)vtd_error->FaultRecord;
-    json_object_object_add(fault_record_ir, "faultInformation", json_object_new_uint64(fault_record->FaultInformation));
-    json_object_object_add(fault_record_ir, "sourceIdentifier", json_object_new_uint64(fault_record->SourceIdentifier));
-    json_object_object_add(fault_record_ir, "privelegeModeRequested", 
-        json_object_new_boolean(fault_record->PrivelegeModeRequested));
-    json_object_object_add(fault_record_ir, "executePermissionRequested", 
-        json_object_new_boolean(fault_record->ExecutePermissionRequested));
-    json_object_object_add(fault_record_ir, "pasidPresent", json_object_new_boolean(fault_record->PasidPresent));
-    json_object_object_add(fault_record_ir, "faultReason", json_object_new_uint64(fault_record->FaultReason));
-    json_object_object_add(fault_record_ir, "pasidValue", json_object_new_uint64(fault_record->PasidValue));
-    json_object_object_add(fault_record_ir, "addressType", json_object_new_uint64(fault_record->AddressType));
+	//Fault record basic fields.
+	json_object *fault_record_ir = json_object_new_object();
+	EFI_VTD_FAULT_RECORD *fault_record =
+		(EFI_VTD_FAULT_RECORD *)vtd_error->FaultRecord;
+	json_object_object_add(
+		fault_record_ir, "faultInformation",
+		json_object_new_uint64(fault_record->FaultInformation));
+	json_object_object_add(
+		fault_record_ir, "sourceIdentifier",
+		json_object_new_uint64(fault_record->SourceIdentifier));
+	json_object_object_add(
+		fault_record_ir, "privelegeModeRequested",
+		json_object_new_boolean(fault_record->PrivelegeModeRequested));
+	json_object_object_add(
+		fault_record_ir, "executePermissionRequested",
+		json_object_new_boolean(
+			fault_record->ExecutePermissionRequested));
+	json_object_object_add(
+		fault_record_ir, "pasidPresent",
+		json_object_new_boolean(fault_record->PasidPresent));
+	json_object_object_add(
+		fault_record_ir, "faultReason",
+		json_object_new_uint64(fault_record->FaultReason));
+	json_object_object_add(
+		fault_record_ir, "pasidValue",
+		json_object_new_uint64(fault_record->PasidValue));
+	json_object_object_add(
+		fault_record_ir, "addressType",
+		json_object_new_uint64(fault_record->AddressType));
 
-    //Fault record type.
-    json_object* fault_record_type = integer_to_readable_pair(fault_record->Type, 2,
-        VTD_FAULT_RECORD_TYPES_KEYS,
-        VTD_FAULT_RECORD_TYPES_VALUES,
-        "Unknown");
-    json_object_object_add(fault_record_ir, "type", fault_record_type);
-    json_object_object_add(section_ir, "faultRecord", fault_record_ir);
+	//Fault record type.
+	json_object *fault_record_type = integer_to_readable_pair(
+		fault_record->Type, 2, VTD_FAULT_RECORD_TYPES_KEYS,
+		VTD_FAULT_RECORD_TYPES_VALUES, "Unknown");
+	json_object_object_add(fault_record_ir, "type", fault_record_type);
+	json_object_object_add(section_ir, "faultRecord", fault_record_ir);
 
-    //Root entry.
-    char* encoded = b64_encode((unsigned char*)vtd_error->RootEntry, 16);
-    json_object_object_add(section_ir, "rootEntry", json_object_new_string(encoded));
-    free(encoded);
+	//Root entry.
+	char *encoded = b64_encode((unsigned char *)vtd_error->RootEntry, 16);
+	json_object_object_add(section_ir, "rootEntry",
+			       json_object_new_string(encoded));
+	free(encoded);
 
-    //Context entry.
-    encoded = b64_encode((unsigned char*)vtd_error->ContextEntry, 16);
-    json_object_object_add(section_ir, "contextEntry", json_object_new_string(encoded));
-    free(encoded);
+	//Context entry.
+	encoded = b64_encode((unsigned char *)vtd_error->ContextEntry, 16);
+	json_object_object_add(section_ir, "contextEntry",
+			       json_object_new_string(encoded));
+	free(encoded);
 
-    //PTE entry for all page levels.
-    json_object_object_add(section_ir, "pageTableEntry_Level6", json_object_new_uint64(vtd_error->PteL6));
-    json_object_object_add(section_ir, "pageTableEntry_Level5", json_object_new_uint64(vtd_error->PteL5));
-    json_object_object_add(section_ir, "pageTableEntry_Level4", json_object_new_uint64(vtd_error->PteL4));
-    json_object_object_add(section_ir, "pageTableEntry_Level3", json_object_new_uint64(vtd_error->PteL3));
-    json_object_object_add(section_ir, "pageTableEntry_Level2", json_object_new_uint64(vtd_error->PteL2));
-    json_object_object_add(section_ir, "pageTableEntry_Level1", json_object_new_uint64(vtd_error->PteL1));
+	//PTE entry for all page levels.
+	json_object_object_add(section_ir, "pageTableEntry_Level6",
+			       json_object_new_uint64(vtd_error->PteL6));
+	json_object_object_add(section_ir, "pageTableEntry_Level5",
+			       json_object_new_uint64(vtd_error->PteL5));
+	json_object_object_add(section_ir, "pageTableEntry_Level4",
+			       json_object_new_uint64(vtd_error->PteL4));
+	json_object_object_add(section_ir, "pageTableEntry_Level3",
+			       json_object_new_uint64(vtd_error->PteL3));
+	json_object_object_add(section_ir, "pageTableEntry_Level2",
+			       json_object_new_uint64(vtd_error->PteL2));
+	json_object_object_add(section_ir, "pageTableEntry_Level1",
+			       json_object_new_uint64(vtd_error->PteL1));
 
-    return section_ir;
+	return section_ir;
 }
 
 //Converts a single VT-d DMAR CPER-JSON segment into CPER binary, outputting to the given stream.
-void ir_section_dmar_vtd_to_cper(json_object* section, FILE* out)
+void ir_section_dmar_vtd_to_cper(json_object *section, FILE *out)
 {
-    EFI_DIRECTED_IO_DMAR_ERROR_DATA* section_cper =
-        (EFI_DIRECTED_IO_DMAR_ERROR_DATA*)calloc(1, sizeof(EFI_DIRECTED_IO_DMAR_ERROR_DATA));
+	EFI_DIRECTED_IO_DMAR_ERROR_DATA *section_cper =
+		(EFI_DIRECTED_IO_DMAR_ERROR_DATA *)calloc(
+			1, sizeof(EFI_DIRECTED_IO_DMAR_ERROR_DATA));
 
-    //OEM ID.
-    UINT64 oem_id = json_object_get_uint64(json_object_object_get(section, "oemID"));
-    for (int i=0; i<6; i++)
-        section_cper->OemId[i] = (oem_id >> (i * 8)) & 0xFF;
+	//OEM ID.
+	UINT64 oem_id = json_object_get_uint64(
+		json_object_object_get(section, "oemID"));
+	for (int i = 0; i < 6; i++)
+		section_cper->OemId[i] = (oem_id >> (i * 8)) & 0xFF;
 
-    //Registers & basic numeric fields.
-    section_cper->Version = (UINT8)json_object_get_int(json_object_object_get(section, "version"));
-    section_cper->Revision = (UINT8)json_object_get_int(json_object_object_get(section, "revision"));
-    section_cper->Capability = json_object_get_uint64(json_object_object_get(section, "capabilityRegister"));
-    section_cper->CapabilityEx = json_object_get_uint64(json_object_object_get(section, "extendedCapabilityRegister"));
-    section_cper->GlobalCommand = json_object_get_uint64(json_object_object_get(section, "globalCommandRegister"));
-    section_cper->GlobalStatus = json_object_get_uint64(json_object_object_get(section, "globalStatusRegister"));
-    section_cper->FaultStatus = json_object_get_uint64(json_object_object_get(section, "faultStatusRegister"));
+	//Registers & basic numeric fields.
+	section_cper->Version = (UINT8)json_object_get_int(
+		json_object_object_get(section, "version"));
+	section_cper->Revision = (UINT8)json_object_get_int(
+		json_object_object_get(section, "revision"));
+	section_cper->Capability = json_object_get_uint64(
+		json_object_object_get(section, "capabilityRegister"));
+	section_cper->CapabilityEx = json_object_get_uint64(
+		json_object_object_get(section, "extendedCapabilityRegister"));
+	section_cper->GlobalCommand = json_object_get_uint64(
+		json_object_object_get(section, "globalCommandRegister"));
+	section_cper->GlobalStatus = json_object_get_uint64(
+		json_object_object_get(section, "globalStatusRegister"));
+	section_cper->FaultStatus = json_object_get_uint64(
+		json_object_object_get(section, "faultStatusRegister"));
 
-    //Fault record.
-    json_object* fault_record = json_object_object_get(section, "faultRecord");
-    EFI_VTD_FAULT_RECORD* fault_record_cper = (EFI_VTD_FAULT_RECORD*)section_cper->FaultRecord;
-    fault_record_cper->FaultInformation = 
-        json_object_get_uint64(json_object_object_get(fault_record, "faultInformation"));
-    fault_record_cper->SourceIdentifier = 
-        json_object_get_uint64(json_object_object_get(fault_record, "sourceIdentifier"));
-    fault_record_cper->PrivelegeModeRequested = 
-        json_object_get_boolean(json_object_object_get(fault_record, "privelegeModeRequested"));
-    fault_record_cper->ExecutePermissionRequested = 
-        json_object_get_boolean(json_object_object_get(fault_record, "executePermissionRequested"));
-    fault_record_cper->PasidPresent = 
-        json_object_get_boolean(json_object_object_get(fault_record, "pasidPresent"));
-    fault_record_cper->FaultReason = 
-        json_object_get_uint64(json_object_object_get(fault_record, "faultReason"));
-    fault_record_cper->PasidValue = 
-        json_object_get_uint64(json_object_object_get(fault_record, "pasidValue"));
-    fault_record_cper->AddressType = 
-        json_object_get_uint64(json_object_object_get(fault_record, "addressType"));
-    fault_record_cper->Type = 
-        readable_pair_to_integer(json_object_object_get(fault_record, "type"));
-        
-    //Root entry.
-    json_object* encoded = json_object_object_get(section, "rootEntry");
-    UINT8* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    memcpy(section_cper->RootEntry, decoded, 16);
-    free(decoded);
+	//Fault record.
+	json_object *fault_record =
+		json_object_object_get(section, "faultRecord");
+	EFI_VTD_FAULT_RECORD *fault_record_cper =
+		(EFI_VTD_FAULT_RECORD *)section_cper->FaultRecord;
+	fault_record_cper->FaultInformation = json_object_get_uint64(
+		json_object_object_get(fault_record, "faultInformation"));
+	fault_record_cper->SourceIdentifier = json_object_get_uint64(
+		json_object_object_get(fault_record, "sourceIdentifier"));
+	fault_record_cper->PrivelegeModeRequested = json_object_get_boolean(
+		json_object_object_get(fault_record, "privelegeModeRequested"));
+	fault_record_cper->ExecutePermissionRequested = json_object_get_boolean(
+		json_object_object_get(fault_record,
+				       "executePermissionRequested"));
+	fault_record_cper->PasidPresent = json_object_get_boolean(
+		json_object_object_get(fault_record, "pasidPresent"));
+	fault_record_cper->FaultReason = json_object_get_uint64(
+		json_object_object_get(fault_record, "faultReason"));
+	fault_record_cper->PasidValue = json_object_get_uint64(
+		json_object_object_get(fault_record, "pasidValue"));
+	fault_record_cper->AddressType = json_object_get_uint64(
+		json_object_object_get(fault_record, "addressType"));
+	fault_record_cper->Type = readable_pair_to_integer(
+		json_object_object_get(fault_record, "type"));
 
-    //Context entry.
-    encoded = json_object_object_get(section, "contextEntry");
-    decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    memcpy(section_cper->ContextEntry, decoded, 16);
-    free(decoded);
+	//Root entry.
+	json_object *encoded = json_object_object_get(section, "rootEntry");
+	UINT8 *decoded = b64_decode(json_object_get_string(encoded),
+				    json_object_get_string_len(encoded));
+	memcpy(section_cper->RootEntry, decoded, 16);
+	free(decoded);
 
-    //Page table entries.
-    section_cper->PteL1 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level1"));
-    section_cper->PteL2 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level2"));
-    section_cper->PteL3 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level3"));
-    section_cper->PteL4 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level4"));
-    section_cper->PteL5 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level5"));
-    section_cper->PteL6 = json_object_get_uint64(json_object_object_get(section, "pageTableEntry_Level6"));
+	//Context entry.
+	encoded = json_object_object_get(section, "contextEntry");
+	decoded = b64_decode(json_object_get_string(encoded),
+			     json_object_get_string_len(encoded));
+	memcpy(section_cper->ContextEntry, decoded, 16);
+	free(decoded);
 
-    //Write to stream, free resources.
-    fwrite(section_cper, sizeof(EFI_DIRECTED_IO_DMAR_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Page table entries.
+	section_cper->PteL1 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level1"));
+	section_cper->PteL2 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level2"));
+	section_cper->PteL3 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level3"));
+	section_cper->PteL4 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level4"));
+	section_cper->PteL5 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level5"));
+	section_cper->PteL6 = json_object_get_uint64(
+		json_object_object_get(section, "pageTableEntry_Level6"));
+
+	//Write to stream, free resources.
+	fwrite(section_cper, sizeof(EFI_DIRECTED_IO_DMAR_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-firmware.c b/sections/cper-section-firmware.c
index 5e17e90..a3c3002 100644
--- a/sections/cper-section-firmware.c
+++ b/sections/cper-section-firmware.c
@@ -11,45 +11,56 @@
 #include "cper-section-firmware.h"
 
 //Converts a single firmware CPER section into JSON IR.
-json_object* cper_section_firmware_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_firmware_to_ir(void *section,
+			    EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_FIRMWARE_ERROR_DATA* firmware_error = (EFI_FIRMWARE_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_FIRMWARE_ERROR_DATA *firmware_error =
+		(EFI_FIRMWARE_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Record type.
-    json_object* record_type = integer_to_readable_pair(firmware_error->ErrorType, 3,
-        FIRMWARE_ERROR_RECORD_TYPES_KEYS,
-        FIRMWARE_ERROR_RECORD_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "errorRecordType", record_type);
+	//Record type.
+	json_object *record_type = integer_to_readable_pair(
+		firmware_error->ErrorType, 3, FIRMWARE_ERROR_RECORD_TYPES_KEYS,
+		FIRMWARE_ERROR_RECORD_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "errorRecordType", record_type);
 
-    //Revision, record identifier.
-    json_object_object_add(section_ir, "revision", json_object_new_int(firmware_error->Revision));
-    json_object_object_add(section_ir, "recordID", json_object_new_uint64(firmware_error->RecordId));
-    
-    //Record GUID.
-    char record_id_guid[GUID_STRING_LENGTH];
-    guid_to_string(record_id_guid, &firmware_error->RecordIdGuid);
-    json_object_object_add(section_ir, "recordIDGUID", json_object_new_string(record_id_guid));
+	//Revision, record identifier.
+	json_object_object_add(section_ir, "revision",
+			       json_object_new_int(firmware_error->Revision));
+	json_object_object_add(
+		section_ir, "recordID",
+		json_object_new_uint64(firmware_error->RecordId));
 
-    return section_ir;
+	//Record GUID.
+	char record_id_guid[GUID_STRING_LENGTH];
+	guid_to_string(record_id_guid, &firmware_error->RecordIdGuid);
+	json_object_object_add(section_ir, "recordIDGUID",
+			       json_object_new_string(record_id_guid));
+
+	return section_ir;
 }
 
 //Converts a single firmware CPER-JSON section into CPER binary, outputting to the given stream.
-void ir_section_firmware_to_cper(json_object* section, FILE* out)
+void ir_section_firmware_to_cper(json_object *section, FILE *out)
 {
-    EFI_FIRMWARE_ERROR_DATA* section_cper =
-        (EFI_FIRMWARE_ERROR_DATA*)calloc(1, sizeof(EFI_FIRMWARE_ERROR_DATA));
+	EFI_FIRMWARE_ERROR_DATA *section_cper =
+		(EFI_FIRMWARE_ERROR_DATA *)calloc(
+			1, sizeof(EFI_FIRMWARE_ERROR_DATA));
 
-    //Record fields.
-    section_cper->ErrorType = readable_pair_to_integer(json_object_object_get(section, "errorRecordType"));
-    section_cper->Revision = json_object_get_int(json_object_object_get(section, "revision"));
-    section_cper->RecordId = json_object_get_uint64(json_object_object_get(section, "recordID"));
-    string_to_guid(&section_cper->RecordIdGuid, 
-        json_object_get_string(json_object_object_get(section, "recordIDGUID")));
+	//Record fields.
+	section_cper->ErrorType = readable_pair_to_integer(
+		json_object_object_get(section, "errorRecordType"));
+	section_cper->Revision = json_object_get_int(
+		json_object_object_get(section, "revision"));
+	section_cper->RecordId = json_object_get_uint64(
+		json_object_object_get(section, "recordID"));
+	string_to_guid(&section_cper->RecordIdGuid,
+		       json_object_get_string(json_object_object_get(
+			       section, "recordIDGUID")));
 
-    //Write to stream, free resources.
-    fwrite(section_cper, sizeof(EFI_FIRMWARE_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write to stream, free resources.
+	fwrite(section_cper, sizeof(EFI_FIRMWARE_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-generic.c b/sections/cper-section-generic.c
index c82730b..f689945 100644
--- a/sections/cper-section-generic.c
+++ b/sections/cper-section-generic.c
@@ -13,106 +13,142 @@
 #include "cper-section-generic.h"
 
 //Converts the given processor-generic CPER section into JSON IR.
-json_object* cper_section_generic_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_generic_to_ir(void *section,
+			   EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_PROCESSOR_GENERIC_ERROR_DATA* section_generic = (EFI_PROCESSOR_GENERIC_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_PROCESSOR_GENERIC_ERROR_DATA *section_generic =
+		(EFI_PROCESSOR_GENERIC_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(section_generic->ValidFields, 13, GENERIC_VALIDATION_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(section_generic->ValidFields, 13,
+			       GENERIC_VALIDATION_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Processor type, with human readable name if possible.
-    json_object* processor_type = integer_to_readable_pair(section_generic->Type, 
-        sizeof(GENERIC_PROC_TYPES_KEYS) / sizeof(int),
-        GENERIC_PROC_TYPES_KEYS,
-        GENERIC_PROC_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "processorType", processor_type);
+	//Processor type, with human readable name if possible.
+	json_object *processor_type = integer_to_readable_pair(
+		section_generic->Type,
+		sizeof(GENERIC_PROC_TYPES_KEYS) / sizeof(int),
+		GENERIC_PROC_TYPES_KEYS, GENERIC_PROC_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(section_ir, "processorType", processor_type);
 
-    //Processor ISA, with human readable name if possible.
-    json_object* processor_isa = integer_to_readable_pair(section_generic->Isa, 
-        sizeof(GENERIC_ISA_TYPES_KEYS) / sizeof(int),
-        GENERIC_ISA_TYPES_KEYS,
-        GENERIC_ISA_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "processorISA", processor_isa);
+	//Processor ISA, with human readable name if possible.
+	json_object *processor_isa = integer_to_readable_pair(
+		section_generic->Isa,
+		sizeof(GENERIC_ISA_TYPES_KEYS) / sizeof(int),
+		GENERIC_ISA_TYPES_KEYS, GENERIC_ISA_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(section_ir, "processorISA", processor_isa);
 
-    //Processor error type, with human readable name if possible.
-    json_object* processor_error_type = integer_to_readable_pair(section_generic->ErrorType, 
-        sizeof(GENERIC_ERROR_TYPES_KEYS) / sizeof(int),
-        GENERIC_ERROR_TYPES_KEYS, 
-        GENERIC_ERROR_TYPES_VALUES, 
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "errorType", processor_error_type);
+	//Processor error type, with human readable name if possible.
+	json_object *processor_error_type = integer_to_readable_pair(
+		section_generic->ErrorType,
+		sizeof(GENERIC_ERROR_TYPES_KEYS) / sizeof(int),
+		GENERIC_ERROR_TYPES_KEYS, GENERIC_ERROR_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(section_ir, "errorType", processor_error_type);
 
-    //The operation performed, with a human readable name if possible.
-    json_object* operation = integer_to_readable_pair(section_generic->Operation, 
-        sizeof(GENERIC_OPERATION_TYPES_KEYS) / sizeof(int),
-        GENERIC_OPERATION_TYPES_KEYS, 
-        GENERIC_OPERATION_TYPES_VALUES, 
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "operation", operation);
+	//The operation performed, with a human readable name if possible.
+	json_object *operation = integer_to_readable_pair(
+		section_generic->Operation,
+		sizeof(GENERIC_OPERATION_TYPES_KEYS) / sizeof(int),
+		GENERIC_OPERATION_TYPES_KEYS, GENERIC_OPERATION_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(section_ir, "operation", operation);
 
-    //Flags, additional information about the error.
-    json_object* flags = bitfield_to_ir(section_generic->Flags, 4, GENERIC_FLAGS_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "flags", flags);
+	//Flags, additional information about the error.
+	json_object *flags = bitfield_to_ir(section_generic->Flags, 4,
+					    GENERIC_FLAGS_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "flags", flags);
 
-    //The level of the error.
-    json_object_object_add(section_ir, "level", json_object_new_int(section_generic->Level));
+	//The level of the error.
+	json_object_object_add(section_ir, "level",
+			       json_object_new_int(section_generic->Level));
 
-    //CPU version information.
-    json_object_object_add(section_ir, "cpuVersionInfo", json_object_new_uint64(section_generic->VersionInfo));
+	//CPU version information.
+	json_object_object_add(
+		section_ir, "cpuVersionInfo",
+		json_object_new_uint64(section_generic->VersionInfo));
 
-    //CPU brand string. May not exist if on ARM.
-    json_object_object_add(section_ir, "cpuBrandString", json_object_new_string(section_generic->BrandString));
+	//CPU brand string. May not exist if on ARM.
+	json_object_object_add(
+		section_ir, "cpuBrandString",
+		json_object_new_string(section_generic->BrandString));
 
-    //Remaining 64-bit fields.
-    json_object_object_add(section_ir, "processorID", json_object_new_uint64(section_generic->ApicId));
-    json_object_object_add(section_ir, "targetAddress", json_object_new_uint64(section_generic->TargetAddr));
-    json_object_object_add(section_ir, "requestorID", json_object_new_uint64(section_generic->RequestorId));
-    json_object_object_add(section_ir, "responderID", json_object_new_uint64(section_generic->ResponderId));
-    json_object_object_add(section_ir, "instructionIP", json_object_new_uint64(section_generic->InstructionIP));
+	//Remaining 64-bit fields.
+	json_object_object_add(section_ir, "processorID",
+			       json_object_new_uint64(section_generic->ApicId));
+	json_object_object_add(
+		section_ir, "targetAddress",
+		json_object_new_uint64(section_generic->TargetAddr));
+	json_object_object_add(
+		section_ir, "requestorID",
+		json_object_new_uint64(section_generic->RequestorId));
+	json_object_object_add(
+		section_ir, "responderID",
+		json_object_new_uint64(section_generic->ResponderId));
+	json_object_object_add(
+		section_ir, "instructionIP",
+		json_object_new_uint64(section_generic->InstructionIP));
 
-    return section_ir;
+	return section_ir;
 }
 
 //Converts the given CPER-JSON processor-generic error section into CPER binary,
 //outputting to the provided stream.
-void ir_section_generic_to_cper(json_object* section, FILE* out)
+void ir_section_generic_to_cper(json_object *section, FILE *out)
 {
-    EFI_PROCESSOR_GENERIC_ERROR_DATA* section_cper = 
-        (EFI_PROCESSOR_GENERIC_ERROR_DATA*)calloc(1, sizeof(EFI_PROCESSOR_GENERIC_ERROR_DATA));
+	EFI_PROCESSOR_GENERIC_ERROR_DATA *section_cper =
+		(EFI_PROCESSOR_GENERIC_ERROR_DATA *)calloc(
+			1, sizeof(EFI_PROCESSOR_GENERIC_ERROR_DATA));
 
-    //Validation bits.
-    section_cper->ValidFields = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        13, GENERIC_VALIDATION_BITFIELD_NAMES);
-        
-    //Various name/value pair fields.
-    section_cper->Type = (UINT8)readable_pair_to_integer(json_object_object_get(section, "processorType"));
-    section_cper->Isa = (UINT8)readable_pair_to_integer(json_object_object_get(section, "processorISA"));
-    section_cper->ErrorType = (UINT8)readable_pair_to_integer(json_object_object_get(section, "errorType"));
-    section_cper->Operation = (UINT8)readable_pair_to_integer(json_object_object_get(section, "operation"));
+	//Validation bits.
+	section_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 13,
+		GENERIC_VALIDATION_BITFIELD_NAMES);
 
-    //Flags.
-    section_cper->Flags = (UINT8)ir_to_bitfield(json_object_object_get(section, "flags"), 4, GENERIC_FLAGS_BITFIELD_NAMES);
+	//Various name/value pair fields.
+	section_cper->Type = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "processorType"));
+	section_cper->Isa = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "processorISA"));
+	section_cper->ErrorType = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "errorType"));
+	section_cper->Operation = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "operation"));
 
-    //Various numeric/string fields.
-    section_cper->Level = (UINT8)json_object_get_int(json_object_object_get(section, "level"));
-    section_cper->VersionInfo = json_object_get_uint64(json_object_object_get(section, "cpuVersionInfo"));
-    section_cper->ApicId = json_object_get_uint64(json_object_object_get(section, "processorID"));
-    section_cper->TargetAddr = json_object_get_uint64(json_object_object_get(section, "targetAddress"));
-    section_cper->RequestorId = json_object_get_uint64(json_object_object_get(section, "requestorID"));
-    section_cper->ResponderId = json_object_get_uint64(json_object_object_get(section, "responderID"));
-    section_cper->InstructionIP = json_object_get_uint64(json_object_object_get(section, "instructionIP"));
+	//Flags.
+	section_cper->Flags =
+		(UINT8)ir_to_bitfield(json_object_object_get(section, "flags"),
+				      4, GENERIC_FLAGS_BITFIELD_NAMES);
 
-    //CPU brand string.
-    const char* brand_string = json_object_get_string(json_object_object_get(section, "cpuBrandString"));
-    if (brand_string != NULL)
-        strncpy(section_cper->BrandString, brand_string, 127);
+	//Various numeric/string fields.
+	section_cper->Level = (UINT8)json_object_get_int(
+		json_object_object_get(section, "level"));
+	section_cper->VersionInfo = json_object_get_uint64(
+		json_object_object_get(section, "cpuVersionInfo"));
+	section_cper->ApicId = json_object_get_uint64(
+		json_object_object_get(section, "processorID"));
+	section_cper->TargetAddr = json_object_get_uint64(
+		json_object_object_get(section, "targetAddress"));
+	section_cper->RequestorId = json_object_get_uint64(
+		json_object_object_get(section, "requestorID"));
+	section_cper->ResponderId = json_object_get_uint64(
+		json_object_object_get(section, "responderID"));
+	section_cper->InstructionIP = json_object_get_uint64(
+		json_object_object_get(section, "instructionIP"));
 
-    //Write & flush out to file, free memory.
-    fwrite(section_cper, sizeof(EFI_PROCESSOR_GENERIC_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);   
+	//CPU brand string.
+	const char *brand_string = json_object_get_string(
+		json_object_object_get(section, "cpuBrandString"));
+	if (brand_string != NULL)
+		strncpy(section_cper->BrandString, brand_string, 127);
+
+	//Write & flush out to file, free memory.
+	fwrite(section_cper, sizeof(EFI_PROCESSOR_GENERIC_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-ia32x64.c b/sections/cper-section-ia32x64.c
index a2f806a..35c5a2e 100644
--- a/sections/cper-section-ia32x64.c
+++ b/sections/cper-section-ia32x64.c
@@ -13,360 +13,523 @@
 #include "cper-section-ia32x64.h"
 
 //Private pre-definitions.
-json_object* cper_ia32x64_processor_error_info_to_ir(EFI_IA32_X64_PROCESS_ERROR_INFO* error_info);
-json_object* cper_ia32x64_cache_tlb_check_to_ir(EFI_IA32_X64_CACHE_CHECK_INFO* cache_tlb_check);
-json_object* cper_ia32x64_bus_check_to_ir(EFI_IA32_X64_BUS_CHECK_INFO* bus_check);
-json_object* cper_ia32x64_ms_check_to_ir(EFI_IA32_X64_MS_CHECK_INFO* ms_check);
-json_object* cper_ia32x64_processor_context_info_to_ir(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* context_info, void** cur_pos);
-json_object* cper_ia32x64_register_32bit_to_ir(EFI_CONTEXT_IA32_REGISTER_STATE* registers);
-json_object* cper_ia32x64_register_64bit_to_ir(EFI_CONTEXT_X64_REGISTER_STATE* registers);
-void ir_ia32x64_error_info_to_cper(json_object* error_info, FILE* out);
-void ir_ia32x64_context_info_to_cper(json_object* context_info, FILE* out);
-void ir_ia32x64_cache_tlb_check_error_to_cper(json_object* check_info, EFI_IA32_X64_CACHE_CHECK_INFO* check_info_cper);
-void ir_ia32x64_bus_check_error_to_cper(json_object* check_info, EFI_IA32_X64_BUS_CHECK_INFO* check_info_cper);
-void ir_ia32x64_ms_check_error_to_cper(json_object* check_info, EFI_IA32_X64_MS_CHECK_INFO* check_info_cper);
-void ir_ia32x64_ia32_registers_to_cper(json_object* registers, FILE* out);
-void ir_ia32x64_x64_registers_to_cper(json_object* registers, FILE* out);
+json_object *cper_ia32x64_processor_error_info_to_ir(
+	EFI_IA32_X64_PROCESS_ERROR_INFO *error_info);
+json_object *cper_ia32x64_cache_tlb_check_to_ir(
+	EFI_IA32_X64_CACHE_CHECK_INFO *cache_tlb_check);
+json_object *
+cper_ia32x64_bus_check_to_ir(EFI_IA32_X64_BUS_CHECK_INFO *bus_check);
+json_object *cper_ia32x64_ms_check_to_ir(EFI_IA32_X64_MS_CHECK_INFO *ms_check);
+json_object *cper_ia32x64_processor_context_info_to_ir(
+	EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *context_info, void **cur_pos);
+json_object *
+cper_ia32x64_register_32bit_to_ir(EFI_CONTEXT_IA32_REGISTER_STATE *registers);
+json_object *
+cper_ia32x64_register_64bit_to_ir(EFI_CONTEXT_X64_REGISTER_STATE *registers);
+void ir_ia32x64_error_info_to_cper(json_object *error_info, FILE *out);
+void ir_ia32x64_context_info_to_cper(json_object *context_info, FILE *out);
+void ir_ia32x64_cache_tlb_check_error_to_cper(
+	json_object *check_info,
+	EFI_IA32_X64_CACHE_CHECK_INFO *check_info_cper);
+void ir_ia32x64_bus_check_error_to_cper(
+	json_object *check_info, EFI_IA32_X64_BUS_CHECK_INFO *check_info_cper);
+void ir_ia32x64_ms_check_error_to_cper(
+	json_object *check_info, EFI_IA32_X64_MS_CHECK_INFO *check_info_cper);
+void ir_ia32x64_ia32_registers_to_cper(json_object *registers, FILE *out);
+void ir_ia32x64_x64_registers_to_cper(json_object *registers, FILE *out);
 
 //////////////////
 /// CPER TO IR ///
 //////////////////
 
 //Converts the IA32/x64 error section described in the given descriptor into intermediate format.
-json_object* cper_section_ia32x64_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_ia32x64_to_ir(void *section,
+			   EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_IA32_X64_PROCESSOR_ERROR_RECORD* record = (EFI_IA32_X64_PROCESSOR_ERROR_RECORD*)section;
-    json_object* record_ir = json_object_new_object();
+	EFI_IA32_X64_PROCESSOR_ERROR_RECORD *record =
+		(EFI_IA32_X64_PROCESSOR_ERROR_RECORD *)section;
+	json_object *record_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validationBits = json_object_new_object();
-    json_object_object_add(validationBits, "localAPICIDValid", json_object_new_boolean(record->ValidFields & 0b1));
-    json_object_object_add(validationBits, "cpuIDInfoValid", json_object_new_boolean((record->ValidFields >> 1) & 0b1));
-    int processor_error_info_num = (record->ValidFields >> 2) & 0b111111;
-    json_object_object_add(validationBits, "processorErrorInfoNum", json_object_new_int(processor_error_info_num));
-    int processor_context_info_num = (record->ValidFields >> 8) & 0b111111;
-    json_object_object_add(validationBits, "processorContextInfoNum", json_object_new_int(processor_context_info_num));
-    json_object_object_add(record_ir, "validationBits", validationBits);
+	//Validation bits.
+	json_object *validationBits = json_object_new_object();
+	json_object_object_add(validationBits, "localAPICIDValid",
+			       json_object_new_boolean(record->ValidFields &
+						       0b1));
+	json_object_object_add(
+		validationBits, "cpuIDInfoValid",
+		json_object_new_boolean((record->ValidFields >> 1) & 0b1));
+	int processor_error_info_num = (record->ValidFields >> 2) & 0b111111;
+	json_object_object_add(validationBits, "processorErrorInfoNum",
+			       json_object_new_int(processor_error_info_num));
+	int processor_context_info_num = (record->ValidFields >> 8) & 0b111111;
+	json_object_object_add(validationBits, "processorContextInfoNum",
+			       json_object_new_int(processor_context_info_num));
+	json_object_object_add(record_ir, "validationBits", validationBits);
 
-    //APIC ID.
-    json_object_object_add(record_ir, "localAPICID", json_object_new_uint64(record->ApicId));
+	//APIC ID.
+	json_object_object_add(record_ir, "localAPICID",
+			       json_object_new_uint64(record->ApicId));
 
-    //CPUID information.
-    json_object* cpuid_info_ir = json_object_new_object();
-    EFI_IA32_X64_CPU_ID* cpuid_info = (EFI_IA32_X64_CPU_ID*)record->CpuIdInfo;
-    json_object_object_add(cpuid_info_ir, "eax", json_object_new_uint64(cpuid_info->Eax));
-    json_object_object_add(cpuid_info_ir, "ebx", json_object_new_uint64(cpuid_info->Ebx));
-    json_object_object_add(cpuid_info_ir, "ecx", json_object_new_uint64(cpuid_info->Ecx));
-    json_object_object_add(cpuid_info_ir, "edx", json_object_new_uint64(cpuid_info->Edx));
-    json_object_object_add(record_ir, "cpuidInfo", cpuid_info_ir);
+	//CPUID information.
+	json_object *cpuid_info_ir = json_object_new_object();
+	EFI_IA32_X64_CPU_ID *cpuid_info =
+		(EFI_IA32_X64_CPU_ID *)record->CpuIdInfo;
+	json_object_object_add(cpuid_info_ir, "eax",
+			       json_object_new_uint64(cpuid_info->Eax));
+	json_object_object_add(cpuid_info_ir, "ebx",
+			       json_object_new_uint64(cpuid_info->Ebx));
+	json_object_object_add(cpuid_info_ir, "ecx",
+			       json_object_new_uint64(cpuid_info->Ecx));
+	json_object_object_add(cpuid_info_ir, "edx",
+			       json_object_new_uint64(cpuid_info->Edx));
+	json_object_object_add(record_ir, "cpuidInfo", cpuid_info_ir);
 
-    //Processor error information, of the amount described above.
-    EFI_IA32_X64_PROCESS_ERROR_INFO* current_error_info = (EFI_IA32_X64_PROCESS_ERROR_INFO*)(record + 1);
-    json_object* error_info_array = json_object_new_array();
-    for (int i=0; i<processor_error_info_num; i++) 
-    {
-        json_object_array_add(error_info_array, cper_ia32x64_processor_error_info_to_ir(current_error_info));
-        current_error_info++;
-    }
-    json_object_object_add(record_ir, "processorErrorInfo", error_info_array);
+	//Processor error information, of the amount described above.
+	EFI_IA32_X64_PROCESS_ERROR_INFO *current_error_info =
+		(EFI_IA32_X64_PROCESS_ERROR_INFO *)(record + 1);
+	json_object *error_info_array = json_object_new_array();
+	for (int i = 0; i < processor_error_info_num; i++) {
+		json_object_array_add(error_info_array,
+				      cper_ia32x64_processor_error_info_to_ir(
+					      current_error_info));
+		current_error_info++;
+	}
+	json_object_object_add(record_ir, "processorErrorInfo",
+			       error_info_array);
 
-    //Processor context information, of the amount described above.
-    EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* current_context_info = (EFI_IA32_X64_PROCESSOR_CONTEXT_INFO*)current_error_info;
-    void* cur_pos = (void*)current_context_info;
-    json_object* context_info_array = json_object_new_array();
-    for (int i=0; i<processor_context_info_num; i++) 
-    {
-        json_object_array_add(context_info_array, cper_ia32x64_processor_context_info_to_ir(current_context_info, &cur_pos));
-        current_context_info = (EFI_IA32_X64_PROCESSOR_CONTEXT_INFO*)cur_pos;
-        //The context array is a non-fixed size, pointer is shifted within the above function.
-    }
-    json_object_object_add(record_ir, "processorContextInfo", context_info_array);
+	//Processor context information, of the amount described above.
+	EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *current_context_info =
+		(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *)current_error_info;
+	void *cur_pos = (void *)current_context_info;
+	json_object *context_info_array = json_object_new_array();
+	for (int i = 0; i < processor_context_info_num; i++) {
+		json_object_array_add(context_info_array,
+				      cper_ia32x64_processor_context_info_to_ir(
+					      current_context_info, &cur_pos));
+		current_context_info =
+			(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *)cur_pos;
+		//The context array is a non-fixed size, pointer is shifted within the above function.
+	}
+	json_object_object_add(record_ir, "processorContextInfo",
+			       context_info_array);
 
-    return record_ir;
+	return record_ir;
 }
 
 //Converts a single IA32/x64 processor error info block into JSON IR format.
-json_object* cper_ia32x64_processor_error_info_to_ir(EFI_IA32_X64_PROCESS_ERROR_INFO* error_info)
+json_object *cper_ia32x64_processor_error_info_to_ir(
+	EFI_IA32_X64_PROCESS_ERROR_INFO *error_info)
 {
-    json_object* error_info_ir = json_object_new_object();
+	json_object *error_info_ir = json_object_new_object();
 
-    //Error structure type (as GUID).
-    char error_type[GUID_STRING_LENGTH];
-    guid_to_string(error_type, &error_info->ErrorType);
-    json_object_object_add(error_info_ir, "type", json_object_new_string(error_type));
+	//Error structure type (as GUID).
+	char error_type[GUID_STRING_LENGTH];
+	guid_to_string(error_type, &error_info->ErrorType);
+	json_object_object_add(error_info_ir, "type",
+			       json_object_new_string(error_type));
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(error_info->ValidFields, 5, IA32X64_PROCESSOR_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(error_info_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(error_info->ValidFields, 5,
+			       IA32X64_PROCESSOR_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(error_info_ir, "validationBits", validation);
 
-    //Add the check information on a per-structure basis.
-    //Cache and TLB check information are identical, so can be equated.
-    json_object* check_information = NULL;
-    if (guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeCacheCheckGuid)
-        || guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeTlbCheckGuid))
-    {
-        check_information = cper_ia32x64_cache_tlb_check_to_ir((EFI_IA32_X64_CACHE_CHECK_INFO*)&error_info->CheckInfo);
-    }
-    else if (guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeBusCheckGuid))
-    {
-        check_information = cper_ia32x64_bus_check_to_ir((EFI_IA32_X64_BUS_CHECK_INFO*)&error_info->CheckInfo);
-    }
-    else if (guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeMsCheckGuid))
-    {
-        check_information = cper_ia32x64_ms_check_to_ir((EFI_IA32_X64_MS_CHECK_INFO*)&error_info->CheckInfo);
-    }
-    else 
-    {
-        //Unknown check information.
-        printf("WARN: Invalid/unknown check information GUID found in IA32/x64 CPER section. Ignoring.\n");
-    }
-    json_object_object_add(error_info_ir, "checkInfo", check_information);
+	//Add the check information on a per-structure basis.
+	//Cache and TLB check information are identical, so can be equated.
+	json_object *check_information = NULL;
+	if (guid_equal(&error_info->ErrorType,
+		       &gEfiIa32x64ErrorTypeCacheCheckGuid) ||
+	    guid_equal(&error_info->ErrorType,
+		       &gEfiIa32x64ErrorTypeTlbCheckGuid)) {
+		check_information = cper_ia32x64_cache_tlb_check_to_ir(
+			(EFI_IA32_X64_CACHE_CHECK_INFO *)&error_info->CheckInfo);
+	} else if (guid_equal(&error_info->ErrorType,
+			      &gEfiIa32x64ErrorTypeBusCheckGuid)) {
+		check_information = cper_ia32x64_bus_check_to_ir(
+			(EFI_IA32_X64_BUS_CHECK_INFO *)&error_info->CheckInfo);
+	} else if (guid_equal(&error_info->ErrorType,
+			      &gEfiIa32x64ErrorTypeMsCheckGuid)) {
+		check_information = cper_ia32x64_ms_check_to_ir(
+			(EFI_IA32_X64_MS_CHECK_INFO *)&error_info->CheckInfo);
+	} else {
+		//Unknown check information.
+		printf("WARN: Invalid/unknown check information GUID found in IA32/x64 CPER section. Ignoring.\n");
+	}
+	json_object_object_add(error_info_ir, "checkInfo", check_information);
 
-    //Target, requestor, and responder identifiers.
-    json_object_object_add(error_info_ir, "targetAddressID", json_object_new_uint64(error_info->TargetId));
-    json_object_object_add(error_info_ir, "requestorID", json_object_new_uint64(error_info->RequestorId));
-    json_object_object_add(error_info_ir, "responderID", json_object_new_uint64(error_info->ResponderId));
-    json_object_object_add(error_info_ir, "instructionPointer", json_object_new_uint64(error_info->InstructionIP));
+	//Target, requestor, and responder identifiers.
+	json_object_object_add(error_info_ir, "targetAddressID",
+			       json_object_new_uint64(error_info->TargetId));
+	json_object_object_add(error_info_ir, "requestorID",
+			       json_object_new_uint64(error_info->RequestorId));
+	json_object_object_add(error_info_ir, "responderID",
+			       json_object_new_uint64(error_info->ResponderId));
+	json_object_object_add(
+		error_info_ir, "instructionPointer",
+		json_object_new_uint64(error_info->InstructionIP));
 
-    return error_info_ir;
+	return error_info_ir;
 }
 
 //Converts a single IA32/x64 cache or TLB check check info block into JSON IR format.
-json_object* cper_ia32x64_cache_tlb_check_to_ir(EFI_IA32_X64_CACHE_CHECK_INFO* cache_tlb_check)
+json_object *cper_ia32x64_cache_tlb_check_to_ir(
+	EFI_IA32_X64_CACHE_CHECK_INFO *cache_tlb_check)
 {
-    json_object* cache_tlb_check_ir = json_object_new_object();
+	json_object *cache_tlb_check_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(cache_tlb_check->ValidFields, 8, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
-    json_object_object_add(cache_tlb_check_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(cache_tlb_check->ValidFields, 8,
+			       IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
+	json_object_object_add(cache_tlb_check_ir, "validationBits",
+			       validation);
 
-    //Transaction type.
-    json_object* transaction_type = integer_to_readable_pair(cache_tlb_check->TransactionType, 3,
-        IA32X64_CHECK_INFO_TRANSACTION_TYPES_KEYS,
-        IA32X64_CHECK_INFO_TRANSACTION_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(cache_tlb_check_ir, "transactionType", transaction_type);
+	//Transaction type.
+	json_object *transaction_type = integer_to_readable_pair(
+		cache_tlb_check->TransactionType, 3,
+		IA32X64_CHECK_INFO_TRANSACTION_TYPES_KEYS,
+		IA32X64_CHECK_INFO_TRANSACTION_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(cache_tlb_check_ir, "transactionType",
+			       transaction_type);
 
-    //Operation.
-    json_object* operation = integer_to_readable_pair(cache_tlb_check->Operation, 9,
-        IA32X64_CHECK_INFO_OPERATION_TYPES_KEYS,
-        IA32X64_CHECK_INFO_OPERATION_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(cache_tlb_check_ir, "operation", operation);
+	//Operation.
+	json_object *operation = integer_to_readable_pair(
+		cache_tlb_check->Operation, 9,
+		IA32X64_CHECK_INFO_OPERATION_TYPES_KEYS,
+		IA32X64_CHECK_INFO_OPERATION_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(cache_tlb_check_ir, "operation", operation);
 
-    //Affected cache/TLB level.
-    json_object_object_add(cache_tlb_check_ir, "level", json_object_new_uint64(cache_tlb_check->Level));
+	//Affected cache/TLB level.
+	json_object_object_add(cache_tlb_check_ir, "level",
+			       json_object_new_uint64(cache_tlb_check->Level));
 
-    //Miscellaneous boolean fields.
-    json_object_object_add(cache_tlb_check_ir, "processorContextCorrupt", json_object_new_boolean(cache_tlb_check->ContextCorrupt));
-    json_object_object_add(cache_tlb_check_ir, "uncorrected", json_object_new_boolean(cache_tlb_check->ErrorUncorrected));
-    json_object_object_add(cache_tlb_check_ir, "preciseIP", json_object_new_boolean(cache_tlb_check->PreciseIp));
-    json_object_object_add(cache_tlb_check_ir, "restartableIP", json_object_new_boolean(cache_tlb_check->RestartableIp));
-    json_object_object_add(cache_tlb_check_ir, "overflow", json_object_new_boolean(cache_tlb_check->Overflow));
+	//Miscellaneous boolean fields.
+	json_object_object_add(
+		cache_tlb_check_ir, "processorContextCorrupt",
+		json_object_new_boolean(cache_tlb_check->ContextCorrupt));
+	json_object_object_add(
+		cache_tlb_check_ir, "uncorrected",
+		json_object_new_boolean(cache_tlb_check->ErrorUncorrected));
+	json_object_object_add(
+		cache_tlb_check_ir, "preciseIP",
+		json_object_new_boolean(cache_tlb_check->PreciseIp));
+	json_object_object_add(
+		cache_tlb_check_ir, "restartableIP",
+		json_object_new_boolean(cache_tlb_check->RestartableIp));
+	json_object_object_add(
+		cache_tlb_check_ir, "overflow",
+		json_object_new_boolean(cache_tlb_check->Overflow));
 
-    return cache_tlb_check_ir;
+	return cache_tlb_check_ir;
 }
 
 //Converts a single IA32/x64 bus check check info block into JSON IR format.
-json_object* cper_ia32x64_bus_check_to_ir(EFI_IA32_X64_BUS_CHECK_INFO* bus_check)
-{ 
-    json_object* bus_check_ir = json_object_new_object();
+json_object *
+cper_ia32x64_bus_check_to_ir(EFI_IA32_X64_BUS_CHECK_INFO *bus_check)
+{
+	json_object *bus_check_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(bus_check->ValidFields, 11, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
-    json_object_object_add(bus_check_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(bus_check->ValidFields, 11,
+			       IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
+	json_object_object_add(bus_check_ir, "validationBits", validation);
 
-    //Transaction type.
-    json_object* transaction_type = integer_to_readable_pair(bus_check->TransactionType, 3,
-        IA32X64_CHECK_INFO_TRANSACTION_TYPES_KEYS,
-        IA32X64_CHECK_INFO_TRANSACTION_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(bus_check_ir, "transactionType", transaction_type);
+	//Transaction type.
+	json_object *transaction_type = integer_to_readable_pair(
+		bus_check->TransactionType, 3,
+		IA32X64_CHECK_INFO_TRANSACTION_TYPES_KEYS,
+		IA32X64_CHECK_INFO_TRANSACTION_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(bus_check_ir, "transactionType",
+			       transaction_type);
 
-    //Operation.
-    json_object* operation = integer_to_readable_pair(bus_check->Operation, 9,
-        IA32X64_CHECK_INFO_OPERATION_TYPES_KEYS,
-        IA32X64_CHECK_INFO_OPERATION_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(bus_check_ir, "operation", operation);
+	//Operation.
+	json_object *operation = integer_to_readable_pair(
+		bus_check->Operation, 9,
+		IA32X64_CHECK_INFO_OPERATION_TYPES_KEYS,
+		IA32X64_CHECK_INFO_OPERATION_TYPES_VALUES,
+		"Unknown (Reserved)");
+	json_object_object_add(bus_check_ir, "operation", operation);
 
-    //Affected bus level.
-    json_object_object_add(bus_check_ir, "level", json_object_new_uint64(bus_check->Level));
+	//Affected bus level.
+	json_object_object_add(bus_check_ir, "level",
+			       json_object_new_uint64(bus_check->Level));
 
-    //Miscellaneous boolean fields.
-    json_object_object_add(bus_check_ir, "processorContextCorrupt", json_object_new_boolean(bus_check->ContextCorrupt));
-    json_object_object_add(bus_check_ir, "uncorrected", json_object_new_boolean(bus_check->ErrorUncorrected));
-    json_object_object_add(bus_check_ir, "preciseIP", json_object_new_boolean(bus_check->PreciseIp));
-    json_object_object_add(bus_check_ir, "restartableIP", json_object_new_boolean(bus_check->RestartableIp));
-    json_object_object_add(bus_check_ir, "overflow", json_object_new_boolean(bus_check->Overflow));
-    json_object_object_add(bus_check_ir, "timedOut", json_object_new_boolean(bus_check->TimeOut));
+	//Miscellaneous boolean fields.
+	json_object_object_add(
+		bus_check_ir, "processorContextCorrupt",
+		json_object_new_boolean(bus_check->ContextCorrupt));
+	json_object_object_add(
+		bus_check_ir, "uncorrected",
+		json_object_new_boolean(bus_check->ErrorUncorrected));
+	json_object_object_add(bus_check_ir, "preciseIP",
+			       json_object_new_boolean(bus_check->PreciseIp));
+	json_object_object_add(
+		bus_check_ir, "restartableIP",
+		json_object_new_boolean(bus_check->RestartableIp));
+	json_object_object_add(bus_check_ir, "overflow",
+			       json_object_new_boolean(bus_check->Overflow));
+	json_object_object_add(bus_check_ir, "timedOut",
+			       json_object_new_boolean(bus_check->TimeOut));
 
-    //Participation type.
-    json_object* participation_type = integer_to_readable_pair(bus_check->ParticipationType, 4,
-        IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_KEYS,
-        IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_VALUES,
-        "Unknown");
-    json_object_object_add(bus_check_ir, "participationType", participation_type);
+	//Participation type.
+	json_object *participation_type = integer_to_readable_pair(
+		bus_check->ParticipationType, 4,
+		IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_KEYS,
+		IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_VALUES, "Unknown");
+	json_object_object_add(bus_check_ir, "participationType",
+			       participation_type);
 
-    //Address space.
-    json_object* address_space = integer_to_readable_pair(bus_check->AddressSpace, 4,
-        IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_KEYS,
-        IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_VALUES,
-        "Unknown");
-    json_object_object_add(bus_check_ir, "addressSpace", address_space);
-    
-    return bus_check_ir;
+	//Address space.
+	json_object *address_space = integer_to_readable_pair(
+		bus_check->AddressSpace, 4,
+		IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_KEYS,
+		IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_VALUES, "Unknown");
+	json_object_object_add(bus_check_ir, "addressSpace", address_space);
+
+	return bus_check_ir;
 }
 
 //Converts a single IA32/x64 MS check check info block into JSON IR format.
-json_object* cper_ia32x64_ms_check_to_ir(EFI_IA32_X64_MS_CHECK_INFO* ms_check)
+json_object *cper_ia32x64_ms_check_to_ir(EFI_IA32_X64_MS_CHECK_INFO *ms_check)
 {
-    json_object* ms_check_ir = json_object_new_object();
+	json_object *ms_check_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(ms_check->ValidFields, 6, IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES);
-    json_object_object_add(ms_check_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation = bitfield_to_ir(
+		ms_check->ValidFields, 6,
+		IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES);
+	json_object_object_add(ms_check_ir, "validationBits", validation);
 
-    //Error type (operation that caused the error).
-    json_object* error_type = integer_to_readable_pair(ms_check->ErrorType, 4,
-        IA32X64_MS_CHECK_INFO_ERROR_TYPES_KEYS,
-        IA32X64_MS_CHECK_INFO_ERROR_TYPES_VALUES,
-        "Unknown (Processor Specific)");
-    json_object_object_add(ms_check_ir, "errorType", error_type);
-    
-    //Miscellaneous fields.
-    json_object_object_add(ms_check_ir, "processorContextCorrupt", json_object_new_boolean(ms_check->ContextCorrupt));
-    json_object_object_add(ms_check_ir, "uncorrected", json_object_new_boolean(ms_check->ErrorUncorrected));
-    json_object_object_add(ms_check_ir, "preciseIP", json_object_new_boolean(ms_check->PreciseIp));
-    json_object_object_add(ms_check_ir, "restartableIP", json_object_new_boolean(ms_check->RestartableIp));
-    json_object_object_add(ms_check_ir, "overflow", json_object_new_boolean(ms_check->Overflow));
+	//Error type (operation that caused the error).
+	json_object *error_type = integer_to_readable_pair(
+		ms_check->ErrorType, 4, IA32X64_MS_CHECK_INFO_ERROR_TYPES_KEYS,
+		IA32X64_MS_CHECK_INFO_ERROR_TYPES_VALUES,
+		"Unknown (Processor Specific)");
+	json_object_object_add(ms_check_ir, "errorType", error_type);
 
-    return ms_check_ir;
+	//Miscellaneous fields.
+	json_object_object_add(
+		ms_check_ir, "processorContextCorrupt",
+		json_object_new_boolean(ms_check->ContextCorrupt));
+	json_object_object_add(
+		ms_check_ir, "uncorrected",
+		json_object_new_boolean(ms_check->ErrorUncorrected));
+	json_object_object_add(ms_check_ir, "preciseIP",
+			       json_object_new_boolean(ms_check->PreciseIp));
+	json_object_object_add(
+		ms_check_ir, "restartableIP",
+		json_object_new_boolean(ms_check->RestartableIp));
+	json_object_object_add(ms_check_ir, "overflow",
+			       json_object_new_boolean(ms_check->Overflow));
+
+	return ms_check_ir;
 }
 
 //Converts a single IA32/x64 processor context info entry into JSON IR format.
-json_object* cper_ia32x64_processor_context_info_to_ir(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* context_info, void** cur_pos)
+json_object *cper_ia32x64_processor_context_info_to_ir(
+	EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *context_info, void **cur_pos)
 {
-    json_object* context_info_ir = json_object_new_object();
+	json_object *context_info_ir = json_object_new_object();
 
-    //Register context type.
-    json_object* context_type = integer_to_readable_pair(context_info->RegisterType, 8,
-        IA32X64_REGISTER_CONTEXT_TYPES_KEYS,
-        IA32X64_REGISTER_CONTEXT_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(context_info_ir, "registerContextType", context_type);
+	//Register context type.
+	json_object *context_type = integer_to_readable_pair(
+		context_info->RegisterType, 8,
+		IA32X64_REGISTER_CONTEXT_TYPES_KEYS,
+		IA32X64_REGISTER_CONTEXT_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(context_info_ir, "registerContextType",
+			       context_type);
 
-    //Register array size, MSR and MM address.
-    json_object_object_add(context_info_ir, "registerArraySize", json_object_new_uint64(context_info->ArraySize));
-    json_object_object_add(context_info_ir, "msrAddress", json_object_new_uint64(context_info->MsrAddress));
-    json_object_object_add(context_info_ir, "mmRegisterAddress", json_object_new_uint64(context_info->MmRegisterAddress));
+	//Register array size, MSR and MM address.
+	json_object_object_add(context_info_ir, "registerArraySize",
+			       json_object_new_uint64(context_info->ArraySize));
+	json_object_object_add(
+		context_info_ir, "msrAddress",
+		json_object_new_uint64(context_info->MsrAddress));
+	json_object_object_add(
+		context_info_ir, "mmRegisterAddress",
+		json_object_new_uint64(context_info->MmRegisterAddress));
 
-    //Register array.
-    json_object* register_array = NULL;
-    if (context_info->RegisterType == EFI_REG_CONTEXT_TYPE_IA32) 
-    {
-        EFI_CONTEXT_IA32_REGISTER_STATE* register_state = (EFI_CONTEXT_IA32_REGISTER_STATE*)(context_info + 1);
-        register_array = cper_ia32x64_register_32bit_to_ir(register_state);
-        *cur_pos = (void*)(register_state + 1);
-    }
-    else if (context_info->RegisterType == EFI_REG_CONTEXT_TYPE_X64) 
-    {
-        EFI_CONTEXT_X64_REGISTER_STATE* register_state = (EFI_CONTEXT_X64_REGISTER_STATE*)(context_info + 1);
-        register_array = cper_ia32x64_register_64bit_to_ir(register_state);
-        *cur_pos = (void*)(register_state + 1);
-    }
-    else 
-    {
-        //No parseable data, just dump as base64 and shift the head to the next item.
-        *cur_pos = (void*)(context_info + 1);
+	//Register array.
+	json_object *register_array = NULL;
+	if (context_info->RegisterType == EFI_REG_CONTEXT_TYPE_IA32) {
+		EFI_CONTEXT_IA32_REGISTER_STATE *register_state =
+			(EFI_CONTEXT_IA32_REGISTER_STATE *)(context_info + 1);
+		register_array =
+			cper_ia32x64_register_32bit_to_ir(register_state);
+		*cur_pos = (void *)(register_state + 1);
+	} else if (context_info->RegisterType == EFI_REG_CONTEXT_TYPE_X64) {
+		EFI_CONTEXT_X64_REGISTER_STATE *register_state =
+			(EFI_CONTEXT_X64_REGISTER_STATE *)(context_info + 1);
+		register_array =
+			cper_ia32x64_register_64bit_to_ir(register_state);
+		*cur_pos = (void *)(register_state + 1);
+	} else {
+		//No parseable data, just dump as base64 and shift the head to the next item.
+		*cur_pos = (void *)(context_info + 1);
 
-        char* encoded = b64_encode((unsigned char*)*cur_pos, context_info->ArraySize);
-        register_array = json_object_new_object();
-        json_object_object_add(register_array, "data", json_object_new_string(encoded));
-        free(encoded);
+		char *encoded = b64_encode((unsigned char *)*cur_pos,
+					   context_info->ArraySize);
+		register_array = json_object_new_object();
+		json_object_object_add(register_array, "data",
+				       json_object_new_string(encoded));
+		free(encoded);
 
-        *cur_pos = (void*)(((char*)*cur_pos) + context_info->ArraySize);
-    }
-    json_object_object_add(context_info_ir, "registerArray", register_array);
+		*cur_pos =
+			(void *)(((char *)*cur_pos) + context_info->ArraySize);
+	}
+	json_object_object_add(context_info_ir, "registerArray",
+			       register_array);
 
-    return context_info_ir;
+	return context_info_ir;
 }
 
 //Converts a single CPER IA32 register state into JSON IR format.
-json_object* cper_ia32x64_register_32bit_to_ir(EFI_CONTEXT_IA32_REGISTER_STATE* registers)
+json_object *
+cper_ia32x64_register_32bit_to_ir(EFI_CONTEXT_IA32_REGISTER_STATE *registers)
 {
-    json_object* ia32_registers = json_object_new_object();
-    json_object_object_add(ia32_registers, "eax", json_object_new_uint64(registers->Eax));
-    json_object_object_add(ia32_registers, "ebx", json_object_new_uint64(registers->Ebx));
-    json_object_object_add(ia32_registers, "ecx", json_object_new_uint64(registers->Ecx));
-    json_object_object_add(ia32_registers, "edx", json_object_new_uint64(registers->Edx));
-    json_object_object_add(ia32_registers, "esi", json_object_new_uint64(registers->Esi));
-    json_object_object_add(ia32_registers, "edi", json_object_new_uint64(registers->Edi));
-    json_object_object_add(ia32_registers, "ebp", json_object_new_uint64(registers->Ebp));
-    json_object_object_add(ia32_registers, "esp", json_object_new_uint64(registers->Esp));
-    json_object_object_add(ia32_registers, "cs", json_object_new_uint64(registers->Cs));
-    json_object_object_add(ia32_registers, "ds", json_object_new_uint64(registers->Ds));
-    json_object_object_add(ia32_registers, "ss", json_object_new_uint64(registers->Ss));
-    json_object_object_add(ia32_registers, "es", json_object_new_uint64(registers->Es));
-    json_object_object_add(ia32_registers, "fs", json_object_new_uint64(registers->Fs));
-    json_object_object_add(ia32_registers, "gs", json_object_new_uint64(registers->Gs));
-    json_object_object_add(ia32_registers, "eflags", json_object_new_uint64(registers->Eflags));
-    json_object_object_add(ia32_registers, "eip", json_object_new_uint64(registers->Eip));
-    json_object_object_add(ia32_registers, "cr0", json_object_new_uint64(registers->Cr0));
-    json_object_object_add(ia32_registers, "cr1", json_object_new_uint64(registers->Cr1));
-    json_object_object_add(ia32_registers, "cr2", json_object_new_uint64(registers->Cr2));
-    json_object_object_add(ia32_registers, "cr3", json_object_new_uint64(registers->Cr3));
-    json_object_object_add(ia32_registers, "cr4", json_object_new_uint64(registers->Cr4));
-    json_object_object_add(ia32_registers, "gdtr", json_object_new_uint64(registers->Gdtr[0] + ((UINT64)registers->Gdtr[1] << 32)));
-    json_object_object_add(ia32_registers, "idtr", json_object_new_uint64(registers->Idtr[0] + ((UINT64)registers->Idtr[1] << 32)));
-    json_object_object_add(ia32_registers, "ldtr", json_object_new_uint64(registers->Ldtr));
-    json_object_object_add(ia32_registers, "tr", json_object_new_uint64(registers->Tr));
+	json_object *ia32_registers = json_object_new_object();
+	json_object_object_add(ia32_registers, "eax",
+			       json_object_new_uint64(registers->Eax));
+	json_object_object_add(ia32_registers, "ebx",
+			       json_object_new_uint64(registers->Ebx));
+	json_object_object_add(ia32_registers, "ecx",
+			       json_object_new_uint64(registers->Ecx));
+	json_object_object_add(ia32_registers, "edx",
+			       json_object_new_uint64(registers->Edx));
+	json_object_object_add(ia32_registers, "esi",
+			       json_object_new_uint64(registers->Esi));
+	json_object_object_add(ia32_registers, "edi",
+			       json_object_new_uint64(registers->Edi));
+	json_object_object_add(ia32_registers, "ebp",
+			       json_object_new_uint64(registers->Ebp));
+	json_object_object_add(ia32_registers, "esp",
+			       json_object_new_uint64(registers->Esp));
+	json_object_object_add(ia32_registers, "cs",
+			       json_object_new_uint64(registers->Cs));
+	json_object_object_add(ia32_registers, "ds",
+			       json_object_new_uint64(registers->Ds));
+	json_object_object_add(ia32_registers, "ss",
+			       json_object_new_uint64(registers->Ss));
+	json_object_object_add(ia32_registers, "es",
+			       json_object_new_uint64(registers->Es));
+	json_object_object_add(ia32_registers, "fs",
+			       json_object_new_uint64(registers->Fs));
+	json_object_object_add(ia32_registers, "gs",
+			       json_object_new_uint64(registers->Gs));
+	json_object_object_add(ia32_registers, "eflags",
+			       json_object_new_uint64(registers->Eflags));
+	json_object_object_add(ia32_registers, "eip",
+			       json_object_new_uint64(registers->Eip));
+	json_object_object_add(ia32_registers, "cr0",
+			       json_object_new_uint64(registers->Cr0));
+	json_object_object_add(ia32_registers, "cr1",
+			       json_object_new_uint64(registers->Cr1));
+	json_object_object_add(ia32_registers, "cr2",
+			       json_object_new_uint64(registers->Cr2));
+	json_object_object_add(ia32_registers, "cr3",
+			       json_object_new_uint64(registers->Cr3));
+	json_object_object_add(ia32_registers, "cr4",
+			       json_object_new_uint64(registers->Cr4));
+	json_object_object_add(
+		ia32_registers, "gdtr",
+		json_object_new_uint64(registers->Gdtr[0] +
+				       ((UINT64)registers->Gdtr[1] << 32)));
+	json_object_object_add(
+		ia32_registers, "idtr",
+		json_object_new_uint64(registers->Idtr[0] +
+				       ((UINT64)registers->Idtr[1] << 32)));
+	json_object_object_add(ia32_registers, "ldtr",
+			       json_object_new_uint64(registers->Ldtr));
+	json_object_object_add(ia32_registers, "tr",
+			       json_object_new_uint64(registers->Tr));
 
-    return ia32_registers;
+	return ia32_registers;
 }
 
 //Converts a single CPER x64 register state into JSON IR format.
-json_object* cper_ia32x64_register_64bit_to_ir(EFI_CONTEXT_X64_REGISTER_STATE* registers)
+json_object *
+cper_ia32x64_register_64bit_to_ir(EFI_CONTEXT_X64_REGISTER_STATE *registers)
 {
-    json_object* x64_registers = json_object_new_object();
-    json_object_object_add(x64_registers, "rax", json_object_new_uint64(registers->Rax));
-    json_object_object_add(x64_registers, "rbx", json_object_new_uint64(registers->Rbx));
-    json_object_object_add(x64_registers, "rcx", json_object_new_uint64(registers->Rcx));
-    json_object_object_add(x64_registers, "rdx", json_object_new_uint64(registers->Rdx));
-    json_object_object_add(x64_registers, "rsi", json_object_new_uint64(registers->Rsi));
-    json_object_object_add(x64_registers, "rdi", json_object_new_uint64(registers->Rdi));
-    json_object_object_add(x64_registers, "rbp", json_object_new_uint64(registers->Rbp));
-    json_object_object_add(x64_registers, "rsp", json_object_new_uint64(registers->Rsp));
-    json_object_object_add(x64_registers, "r8", json_object_new_uint64(registers->R8));
-    json_object_object_add(x64_registers, "r9", json_object_new_uint64(registers->R9));
-    json_object_object_add(x64_registers, "r10", json_object_new_uint64(registers->R10));
-    json_object_object_add(x64_registers, "r11", json_object_new_uint64(registers->R11));
-    json_object_object_add(x64_registers, "r12", json_object_new_uint64(registers->R12));
-    json_object_object_add(x64_registers, "r13", json_object_new_uint64(registers->R13));
-    json_object_object_add(x64_registers, "r14", json_object_new_uint64(registers->R14));
-    json_object_object_add(x64_registers, "r15", json_object_new_uint64(registers->R15));
-    json_object_object_add(x64_registers, "cs", json_object_new_int(registers->Cs));
-    json_object_object_add(x64_registers, "ds", json_object_new_int(registers->Ds));
-    json_object_object_add(x64_registers, "ss", json_object_new_int(registers->Ss));
-    json_object_object_add(x64_registers, "es", json_object_new_int(registers->Es));
-    json_object_object_add(x64_registers, "fs", json_object_new_int(registers->Fs));
-    json_object_object_add(x64_registers, "gs", json_object_new_int(registers->Gs));
-    json_object_object_add(x64_registers, "rflags", json_object_new_uint64(registers->Rflags));
-    json_object_object_add(x64_registers, "eip", json_object_new_uint64(registers->Rip));
-    json_object_object_add(x64_registers, "cr0", json_object_new_uint64(registers->Cr0));
-    json_object_object_add(x64_registers, "cr1", json_object_new_uint64(registers->Cr1));
-    json_object_object_add(x64_registers, "cr2", json_object_new_uint64(registers->Cr2));
-    json_object_object_add(x64_registers, "cr3", json_object_new_uint64(registers->Cr3));
-    json_object_object_add(x64_registers, "cr4", json_object_new_uint64(registers->Cr4));
-    json_object_object_add(x64_registers, "cr8", json_object_new_uint64(registers->Cr8));
-    json_object_object_add(x64_registers, "gdtr_0", json_object_new_uint64(registers->Gdtr[0]));
-    json_object_object_add(x64_registers, "gdtr_1", json_object_new_uint64(registers->Gdtr[1]));
-    json_object_object_add(x64_registers, "idtr_0", json_object_new_uint64(registers->Idtr[0]));
-    json_object_object_add(x64_registers, "idtr_1", json_object_new_uint64(registers->Idtr[1]));
-    json_object_object_add(x64_registers, "ldtr", json_object_new_int(registers->Ldtr));
-    json_object_object_add(x64_registers, "tr", json_object_new_int(registers->Tr));
+	json_object *x64_registers = json_object_new_object();
+	json_object_object_add(x64_registers, "rax",
+			       json_object_new_uint64(registers->Rax));
+	json_object_object_add(x64_registers, "rbx",
+			       json_object_new_uint64(registers->Rbx));
+	json_object_object_add(x64_registers, "rcx",
+			       json_object_new_uint64(registers->Rcx));
+	json_object_object_add(x64_registers, "rdx",
+			       json_object_new_uint64(registers->Rdx));
+	json_object_object_add(x64_registers, "rsi",
+			       json_object_new_uint64(registers->Rsi));
+	json_object_object_add(x64_registers, "rdi",
+			       json_object_new_uint64(registers->Rdi));
+	json_object_object_add(x64_registers, "rbp",
+			       json_object_new_uint64(registers->Rbp));
+	json_object_object_add(x64_registers, "rsp",
+			       json_object_new_uint64(registers->Rsp));
+	json_object_object_add(x64_registers, "r8",
+			       json_object_new_uint64(registers->R8));
+	json_object_object_add(x64_registers, "r9",
+			       json_object_new_uint64(registers->R9));
+	json_object_object_add(x64_registers, "r10",
+			       json_object_new_uint64(registers->R10));
+	json_object_object_add(x64_registers, "r11",
+			       json_object_new_uint64(registers->R11));
+	json_object_object_add(x64_registers, "r12",
+			       json_object_new_uint64(registers->R12));
+	json_object_object_add(x64_registers, "r13",
+			       json_object_new_uint64(registers->R13));
+	json_object_object_add(x64_registers, "r14",
+			       json_object_new_uint64(registers->R14));
+	json_object_object_add(x64_registers, "r15",
+			       json_object_new_uint64(registers->R15));
+	json_object_object_add(x64_registers, "cs",
+			       json_object_new_int(registers->Cs));
+	json_object_object_add(x64_registers, "ds",
+			       json_object_new_int(registers->Ds));
+	json_object_object_add(x64_registers, "ss",
+			       json_object_new_int(registers->Ss));
+	json_object_object_add(x64_registers, "es",
+			       json_object_new_int(registers->Es));
+	json_object_object_add(x64_registers, "fs",
+			       json_object_new_int(registers->Fs));
+	json_object_object_add(x64_registers, "gs",
+			       json_object_new_int(registers->Gs));
+	json_object_object_add(x64_registers, "rflags",
+			       json_object_new_uint64(registers->Rflags));
+	json_object_object_add(x64_registers, "eip",
+			       json_object_new_uint64(registers->Rip));
+	json_object_object_add(x64_registers, "cr0",
+			       json_object_new_uint64(registers->Cr0));
+	json_object_object_add(x64_registers, "cr1",
+			       json_object_new_uint64(registers->Cr1));
+	json_object_object_add(x64_registers, "cr2",
+			       json_object_new_uint64(registers->Cr2));
+	json_object_object_add(x64_registers, "cr3",
+			       json_object_new_uint64(registers->Cr3));
+	json_object_object_add(x64_registers, "cr4",
+			       json_object_new_uint64(registers->Cr4));
+	json_object_object_add(x64_registers, "cr8",
+			       json_object_new_uint64(registers->Cr8));
+	json_object_object_add(x64_registers, "gdtr_0",
+			       json_object_new_uint64(registers->Gdtr[0]));
+	json_object_object_add(x64_registers, "gdtr_1",
+			       json_object_new_uint64(registers->Gdtr[1]));
+	json_object_object_add(x64_registers, "idtr_0",
+			       json_object_new_uint64(registers->Idtr[0]));
+	json_object_object_add(x64_registers, "idtr_1",
+			       json_object_new_uint64(registers->Idtr[1]));
+	json_object_object_add(x64_registers, "ldtr",
+			       json_object_new_int(registers->Ldtr));
+	json_object_object_add(x64_registers, "tr",
+			       json_object_new_int(registers->Tr));
 
-    return x64_registers;
+	return x64_registers;
 }
 
 //////////////////
@@ -374,273 +537,415 @@
 //////////////////
 
 //Converts a single IA32/x64 CPER-JSON section into CPER binary, outputting to the provided stream.
-void ir_section_ia32x64_to_cper(json_object* section, FILE* out)
+void ir_section_ia32x64_to_cper(json_object *section, FILE *out)
 {
-    EFI_IA32_X64_PROCESSOR_ERROR_RECORD* section_cper = 
-        (EFI_IA32_X64_PROCESSOR_ERROR_RECORD*)calloc(1, sizeof(EFI_IA32_X64_PROCESSOR_ERROR_RECORD));
+	EFI_IA32_X64_PROCESSOR_ERROR_RECORD *section_cper =
+		(EFI_IA32_X64_PROCESSOR_ERROR_RECORD *)calloc(
+			1, sizeof(EFI_IA32_X64_PROCESSOR_ERROR_RECORD));
 
-    //Validation bits.
-    json_object* validation = json_object_object_get(section, "validationBits");
-    section_cper->ValidFields = 0x0;
-    section_cper->ValidFields |= json_object_get_boolean(json_object_object_get(validation, "localAPICIDValid"));
-    section_cper->ValidFields |= json_object_get_boolean(json_object_object_get(validation, "cpuIDInfoValid")) << 1;
-    int proc_error_info_num = json_object_get_int(json_object_object_get(validation, "processorErrorInfoNum")) & 0b111111;
-    int proc_ctx_info_num = json_object_get_int(json_object_object_get(validation, "processorContextInfoNum")) & 0b111111;
-    section_cper->ValidFields |= proc_error_info_num << 2;
-    section_cper->ValidFields |= proc_ctx_info_num << 8;
+	//Validation bits.
+	json_object *validation =
+		json_object_object_get(section, "validationBits");
+	section_cper->ValidFields = 0x0;
+	section_cper->ValidFields |= json_object_get_boolean(
+		json_object_object_get(validation, "localAPICIDValid"));
+	section_cper->ValidFields |=
+		json_object_get_boolean(
+			json_object_object_get(validation, "cpuIDInfoValid"))
+		<< 1;
+	int proc_error_info_num =
+		json_object_get_int(json_object_object_get(
+			validation, "processorErrorInfoNum")) &
+		0b111111;
+	int proc_ctx_info_num =
+		json_object_get_int(json_object_object_get(
+			validation, "processorContextInfoNum")) &
+		0b111111;
+	section_cper->ValidFields |= proc_error_info_num << 2;
+	section_cper->ValidFields |= proc_ctx_info_num << 8;
 
-    //Local APIC ID.
-    section_cper->ApicId = json_object_get_uint64(json_object_object_get(section, "localAPICID"));
-    
-    //CPUID info.
-    json_object* cpuid_info = json_object_object_get(section, "cpuidInfo");
-    EFI_IA32_X64_CPU_ID* cpuid_info_cper = (EFI_IA32_X64_CPU_ID*)section_cper->CpuIdInfo;
-    cpuid_info_cper->Eax = json_object_get_uint64(json_object_object_get(cpuid_info, "eax"));
-    cpuid_info_cper->Ebx = json_object_get_uint64(json_object_object_get(cpuid_info, "ebx"));
-    cpuid_info_cper->Ecx = json_object_get_uint64(json_object_object_get(cpuid_info, "ecx"));
-    cpuid_info_cper->Edx = json_object_get_uint64(json_object_object_get(cpuid_info, "edx"));
+	//Local APIC ID.
+	section_cper->ApicId = json_object_get_uint64(
+		json_object_object_get(section, "localAPICID"));
 
-    //Flush the header to file before dealing w/ info sections.
-    fwrite(section_cper, sizeof(EFI_IA32_X64_PROCESSOR_ERROR_RECORD), 1, out);
-    fflush(out);
-    free(section_cper);
+	//CPUID info.
+	json_object *cpuid_info = json_object_object_get(section, "cpuidInfo");
+	EFI_IA32_X64_CPU_ID *cpuid_info_cper =
+		(EFI_IA32_X64_CPU_ID *)section_cper->CpuIdInfo;
+	cpuid_info_cper->Eax = json_object_get_uint64(
+		json_object_object_get(cpuid_info, "eax"));
+	cpuid_info_cper->Ebx = json_object_get_uint64(
+		json_object_object_get(cpuid_info, "ebx"));
+	cpuid_info_cper->Ecx = json_object_get_uint64(
+		json_object_object_get(cpuid_info, "ecx"));
+	cpuid_info_cper->Edx = json_object_get_uint64(
+		json_object_object_get(cpuid_info, "edx"));
 
-    //Iterate and deal with sections.
-    json_object* error_info = json_object_object_get(section, "processorErrorInfo");
-    json_object* context_info = json_object_object_get(section, "processorContextInfo");
-    for (int i=0; i<proc_error_info_num; i++)
-        ir_ia32x64_error_info_to_cper(json_object_array_get_idx(error_info, i), out);
-    for (int i=0; i<proc_ctx_info_num; i++)
-        ir_ia32x64_context_info_to_cper(json_object_array_get_idx(context_info, i), out);
+	//Flush the header to file before dealing w/ info sections.
+	fwrite(section_cper, sizeof(EFI_IA32_X64_PROCESSOR_ERROR_RECORD), 1,
+	       out);
+	fflush(out);
+	free(section_cper);
+
+	//Iterate and deal with sections.
+	json_object *error_info =
+		json_object_object_get(section, "processorErrorInfo");
+	json_object *context_info =
+		json_object_object_get(section, "processorContextInfo");
+	for (int i = 0; i < proc_error_info_num; i++)
+		ir_ia32x64_error_info_to_cper(
+			json_object_array_get_idx(error_info, i), out);
+	for (int i = 0; i < proc_ctx_info_num; i++)
+		ir_ia32x64_context_info_to_cper(
+			json_object_array_get_idx(context_info, i), out);
 }
 
 //Converts a single CPER-JSON IA32/x64 error information structure into CPER binary, outputting to the
 //provided stream.
-void ir_ia32x64_error_info_to_cper(json_object* error_info, FILE* out)
+void ir_ia32x64_error_info_to_cper(json_object *error_info, FILE *out)
 {
-    EFI_IA32_X64_PROCESS_ERROR_INFO* error_info_cper = 
-        (EFI_IA32_X64_PROCESS_ERROR_INFO*)calloc(1, sizeof(EFI_IA32_X64_PROCESS_ERROR_INFO));
+	EFI_IA32_X64_PROCESS_ERROR_INFO *error_info_cper =
+		(EFI_IA32_X64_PROCESS_ERROR_INFO *)calloc(
+			1, sizeof(EFI_IA32_X64_PROCESS_ERROR_INFO));
 
-    //Error structure type.
-    string_to_guid(&error_info_cper->ErrorType, json_object_get_string(json_object_object_get(error_info, "type")));
+	//Error structure type.
+	string_to_guid(&error_info_cper->ErrorType,
+		       json_object_get_string(
+			       json_object_object_get(error_info, "type")));
 
-    //Validation bits.
-    error_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(error_info, "validationBits"), 
-        5, IA32X64_PROCESSOR_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	error_info_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(error_info, "validationBits"), 5,
+		IA32X64_PROCESSOR_ERROR_VALID_BITFIELD_NAMES);
 
-    //Check information, parsed based on the error type.
-    json_object* check_info = json_object_object_get(error_info, "checkInfo");
-    if (guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeCacheCheckGuid)
-        || guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeTlbCheckGuid))
-    {
-        ir_ia32x64_cache_tlb_check_error_to_cper(check_info, (EFI_IA32_X64_CACHE_CHECK_INFO*)&error_info_cper->CheckInfo);
-    }
-    else if (guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeBusCheckGuid))
-        ir_ia32x64_bus_check_error_to_cper(check_info, (EFI_IA32_X64_BUS_CHECK_INFO*)&error_info_cper->CheckInfo);
-    else if (guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeMsCheckGuid))
-        ir_ia32x64_ms_check_error_to_cper(check_info, (EFI_IA32_X64_MS_CHECK_INFO*)&error_info_cper->CheckInfo);
+	//Check information, parsed based on the error type.
+	json_object *check_info =
+		json_object_object_get(error_info, "checkInfo");
+	if (guid_equal(&error_info_cper->ErrorType,
+		       &gEfiIa32x64ErrorTypeCacheCheckGuid) ||
+	    guid_equal(&error_info_cper->ErrorType,
+		       &gEfiIa32x64ErrorTypeTlbCheckGuid)) {
+		ir_ia32x64_cache_tlb_check_error_to_cper(
+			check_info,
+			(EFI_IA32_X64_CACHE_CHECK_INFO *)&error_info_cper
+				->CheckInfo);
+	} else if (guid_equal(&error_info_cper->ErrorType,
+			      &gEfiIa32x64ErrorTypeBusCheckGuid))
+		ir_ia32x64_bus_check_error_to_cper(
+			check_info,
+			(EFI_IA32_X64_BUS_CHECK_INFO *)&error_info_cper
+				->CheckInfo);
+	else if (guid_equal(&error_info_cper->ErrorType,
+			    &gEfiIa32x64ErrorTypeMsCheckGuid))
+		ir_ia32x64_ms_check_error_to_cper(
+			check_info,
+			(EFI_IA32_X64_MS_CHECK_INFO *)&error_info_cper
+				->CheckInfo);
 
-    //Miscellaneous numeric fields.
-    error_info_cper->TargetId = json_object_get_uint64(json_object_object_get(error_info, "targetAddressID"));
-    error_info_cper->RequestorId = json_object_get_uint64(json_object_object_get(error_info, "requestorID"));
-    error_info_cper->ResponderId = json_object_get_uint64(json_object_object_get(error_info, "responderID"));
-    error_info_cper->InstructionIP = json_object_get_uint64(json_object_object_get(error_info, "instructionPointer"));
+	//Miscellaneous numeric fields.
+	error_info_cper->TargetId = json_object_get_uint64(
+		json_object_object_get(error_info, "targetAddressID"));
+	error_info_cper->RequestorId = json_object_get_uint64(
+		json_object_object_get(error_info, "requestorID"));
+	error_info_cper->ResponderId = json_object_get_uint64(
+		json_object_object_get(error_info, "responderID"));
+	error_info_cper->InstructionIP = json_object_get_uint64(
+		json_object_object_get(error_info, "instructionPointer"));
 
-    //Write out to stream, then free resources.
-    fwrite(error_info_cper, sizeof(EFI_IA32_X64_PROCESS_ERROR_INFO), 1, out);
-    fflush(out);
-    free(error_info_cper);
+	//Write out to stream, then free resources.
+	fwrite(error_info_cper, sizeof(EFI_IA32_X64_PROCESS_ERROR_INFO), 1,
+	       out);
+	fflush(out);
+	free(error_info_cper);
 }
 
 //Converts a single CPER-JSON IA32/x64 cache/TLB check error info structure to CPER binary.
-void ir_ia32x64_cache_tlb_check_error_to_cper(json_object* check_info, EFI_IA32_X64_CACHE_CHECK_INFO* check_info_cper)
+void ir_ia32x64_cache_tlb_check_error_to_cper(
+	json_object *check_info, EFI_IA32_X64_CACHE_CHECK_INFO *check_info_cper)
 {
-    //Validation bits.
-    check_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(check_info, "validationBits"), 
-        8, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	check_info_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(check_info, "validationBits"), 8,
+		IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
 
-    //Transaction type, operation.
-    check_info_cper->TransactionType = readable_pair_to_integer(json_object_object_get(check_info, "transactionType"));
-    check_info_cper->Operation = readable_pair_to_integer(json_object_object_get(check_info, "operation"));
+	//Transaction type, operation.
+	check_info_cper->TransactionType = readable_pair_to_integer(
+		json_object_object_get(check_info, "transactionType"));
+	check_info_cper->Operation = readable_pair_to_integer(
+		json_object_object_get(check_info, "operation"));
 
-    //Miscellaneous raw value fields.
-    check_info_cper->Level = json_object_get_uint64(json_object_object_get(check_info, "level"));
-    check_info_cper->ContextCorrupt = json_object_get_boolean(json_object_object_get(check_info, "processorContextCorrupt"));
-    check_info_cper->ErrorUncorrected = json_object_get_boolean(json_object_object_get(check_info, "uncorrected"));
-    check_info_cper->PreciseIp = json_object_get_boolean(json_object_object_get(check_info, "preciseIP"));
-    check_info_cper->RestartableIp = json_object_get_boolean(json_object_object_get(check_info, "restartableIP"));
-    check_info_cper->Overflow = json_object_get_boolean(json_object_object_get(check_info, "overflow"));
+	//Miscellaneous raw value fields.
+	check_info_cper->Level = json_object_get_uint64(
+		json_object_object_get(check_info, "level"));
+	check_info_cper->ContextCorrupt = json_object_get_boolean(
+		json_object_object_get(check_info, "processorContextCorrupt"));
+	check_info_cper->ErrorUncorrected = json_object_get_boolean(
+		json_object_object_get(check_info, "uncorrected"));
+	check_info_cper->PreciseIp = json_object_get_boolean(
+		json_object_object_get(check_info, "preciseIP"));
+	check_info_cper->RestartableIp = json_object_get_boolean(
+		json_object_object_get(check_info, "restartableIP"));
+	check_info_cper->Overflow = json_object_get_boolean(
+		json_object_object_get(check_info, "overflow"));
 }
 
 //Converts a single CPER-JSON IA32/x64 bus error info structure to CPER binary.
-void ir_ia32x64_bus_check_error_to_cper(json_object* check_info, EFI_IA32_X64_BUS_CHECK_INFO* check_info_cper)
+void ir_ia32x64_bus_check_error_to_cper(
+	json_object *check_info, EFI_IA32_X64_BUS_CHECK_INFO *check_info_cper)
 {
-    //Validation bits.
-    check_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(check_info, "validationBits"), 
-        11, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	check_info_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(check_info, "validationBits"), 11,
+		IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
 
-    //Readable pair fields.
-    check_info_cper->TransactionType = readable_pair_to_integer(json_object_object_get(check_info, "transactionType"));
-    check_info_cper->Operation = readable_pair_to_integer(json_object_object_get(check_info, "operation"));
-    check_info_cper->ParticipationType = readable_pair_to_integer(json_object_object_get(check_info, "participationType"));
-    check_info_cper->AddressSpace = readable_pair_to_integer(json_object_object_get(check_info, "addressSpace"));
+	//Readable pair fields.
+	check_info_cper->TransactionType = readable_pair_to_integer(
+		json_object_object_get(check_info, "transactionType"));
+	check_info_cper->Operation = readable_pair_to_integer(
+		json_object_object_get(check_info, "operation"));
+	check_info_cper->ParticipationType = readable_pair_to_integer(
+		json_object_object_get(check_info, "participationType"));
+	check_info_cper->AddressSpace = readable_pair_to_integer(
+		json_object_object_get(check_info, "addressSpace"));
 
-    //Miscellaneous raw value fields.
-    check_info_cper->Level = json_object_get_uint64(json_object_object_get(check_info, "level"));
-    check_info_cper->ContextCorrupt = json_object_get_boolean(json_object_object_get(check_info, "processorContextCorrupt"));
-    check_info_cper->ErrorUncorrected = json_object_get_boolean(json_object_object_get(check_info, "uncorrected"));
-    check_info_cper->PreciseIp = json_object_get_boolean(json_object_object_get(check_info, "preciseIP"));
-    check_info_cper->RestartableIp = json_object_get_boolean(json_object_object_get(check_info, "restartableIP"));
-    check_info_cper->Overflow = json_object_get_boolean(json_object_object_get(check_info, "overflow"));
-    check_info_cper->TimeOut = json_object_get_boolean(json_object_object_get(check_info, "timedOut"));
+	//Miscellaneous raw value fields.
+	check_info_cper->Level = json_object_get_uint64(
+		json_object_object_get(check_info, "level"));
+	check_info_cper->ContextCorrupt = json_object_get_boolean(
+		json_object_object_get(check_info, "processorContextCorrupt"));
+	check_info_cper->ErrorUncorrected = json_object_get_boolean(
+		json_object_object_get(check_info, "uncorrected"));
+	check_info_cper->PreciseIp = json_object_get_boolean(
+		json_object_object_get(check_info, "preciseIP"));
+	check_info_cper->RestartableIp = json_object_get_boolean(
+		json_object_object_get(check_info, "restartableIP"));
+	check_info_cper->Overflow = json_object_get_boolean(
+		json_object_object_get(check_info, "overflow"));
+	check_info_cper->TimeOut = json_object_get_boolean(
+		json_object_object_get(check_info, "timedOut"));
 }
 
 //Converts a single CPER-JSON IA32/x64 MS error info structure to CPER binary.
-void ir_ia32x64_ms_check_error_to_cper(json_object* check_info, EFI_IA32_X64_MS_CHECK_INFO* check_info_cper)
+void ir_ia32x64_ms_check_error_to_cper(
+	json_object *check_info, EFI_IA32_X64_MS_CHECK_INFO *check_info_cper)
 {
-    //Validation bits.
-    check_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(check_info, "validationBits"), 
-        6, IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	check_info_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(check_info, "validationBits"), 6,
+		IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES);
 
-    //Type of MS check error.
-    check_info_cper->ErrorType = readable_pair_to_integer(json_object_object_get(check_info, "errorType"));
+	//Type of MS check error.
+	check_info_cper->ErrorType = readable_pair_to_integer(
+		json_object_object_get(check_info, "errorType"));
 
-    //Miscellaneous raw value fields.
-    check_info_cper->ContextCorrupt = json_object_get_boolean(json_object_object_get(check_info, "processorContextCorrupt"));
-    check_info_cper->ErrorUncorrected = json_object_get_boolean(json_object_object_get(check_info, "uncorrected"));
-    check_info_cper->PreciseIp = json_object_get_boolean(json_object_object_get(check_info, "preciseIP"));
-    check_info_cper->RestartableIp = json_object_get_boolean(json_object_object_get(check_info, "restartableIP"));
-    check_info_cper->Overflow = json_object_get_boolean(json_object_object_get(check_info, "overflow"));
+	//Miscellaneous raw value fields.
+	check_info_cper->ContextCorrupt = json_object_get_boolean(
+		json_object_object_get(check_info, "processorContextCorrupt"));
+	check_info_cper->ErrorUncorrected = json_object_get_boolean(
+		json_object_object_get(check_info, "uncorrected"));
+	check_info_cper->PreciseIp = json_object_get_boolean(
+		json_object_object_get(check_info, "preciseIP"));
+	check_info_cper->RestartableIp = json_object_get_boolean(
+		json_object_object_get(check_info, "restartableIP"));
+	check_info_cper->Overflow = json_object_get_boolean(
+		json_object_object_get(check_info, "overflow"));
 }
 
 //Converts a single CPER-JSON IA32/x64 context information structure into CPER binary, outputting to the
 //provided stream.
-void ir_ia32x64_context_info_to_cper(json_object* context_info, FILE* out)
+void ir_ia32x64_context_info_to_cper(json_object *context_info, FILE *out)
 {
-    EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* context_info_cper = 
-        (EFI_IA32_X64_PROCESSOR_CONTEXT_INFO*)calloc(1, sizeof(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO));
+	EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *context_info_cper =
+		(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *)calloc(
+			1, sizeof(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO));
 
-    //Register context type.
-    context_info_cper->RegisterType = (UINT16)readable_pair_to_integer(json_object_object_get(context_info, "registerContextType"));
+	//Register context type.
+	context_info_cper->RegisterType = (UINT16)readable_pair_to_integer(
+		json_object_object_get(context_info, "registerContextType"));
 
-    //Miscellaneous numeric fields.
-    context_info_cper->ArraySize = (UINT16)json_object_get_uint64(json_object_object_get(context_info, "registerArraySize"));
-    context_info_cper->MsrAddress = (UINT32)json_object_get_uint64(json_object_object_get(context_info, "msrAddress"));
-    context_info_cper->MmRegisterAddress = json_object_get_uint64(json_object_object_get(context_info, "mmRegisterAddress"));
+	//Miscellaneous numeric fields.
+	context_info_cper->ArraySize = (UINT16)json_object_get_uint64(
+		json_object_object_get(context_info, "registerArraySize"));
+	context_info_cper->MsrAddress = (UINT32)json_object_get_uint64(
+		json_object_object_get(context_info, "msrAddress"));
+	context_info_cper->MmRegisterAddress = json_object_get_uint64(
+		json_object_object_get(context_info, "mmRegisterAddress"));
 
-    //Flush header to stream.
-    fwrite(context_info_cper, sizeof(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO), 1, out);
-    fflush(out);
+	//Flush header to stream.
+	fwrite(context_info_cper, sizeof(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO),
+	       1, out);
+	fflush(out);
 
-    //Handle the register array, depending on type provided.
-    json_object* register_array = json_object_object_get(context_info, "registerArray");
-    if (context_info_cper->RegisterType == EFI_REG_CONTEXT_TYPE_IA32)
-    {
-        ir_ia32x64_ia32_registers_to_cper(register_array, out);
-    }
-    else if (context_info_cper->RegisterType == EFI_REG_CONTEXT_TYPE_X64)
-    {
-        ir_ia32x64_x64_registers_to_cper(register_array, out);
-    }
-    else 
-    {
-        //Unknown/structure is not defined.
-        json_object* encoded = json_object_object_get(register_array, "data");
-        char* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-        fwrite(decoded, context_info_cper->ArraySize, 1, out);
-        fflush(out);
-    }
+	//Handle the register array, depending on type provided.
+	json_object *register_array =
+		json_object_object_get(context_info, "registerArray");
+	if (context_info_cper->RegisterType == EFI_REG_CONTEXT_TYPE_IA32) {
+		ir_ia32x64_ia32_registers_to_cper(register_array, out);
+	} else if (context_info_cper->RegisterType ==
+		   EFI_REG_CONTEXT_TYPE_X64) {
+		ir_ia32x64_x64_registers_to_cper(register_array, out);
+	} else {
+		//Unknown/structure is not defined.
+		json_object *encoded =
+			json_object_object_get(register_array, "data");
+		char *decoded = b64_decode(json_object_get_string(encoded),
+					   json_object_get_string_len(encoded));
+		fwrite(decoded, context_info_cper->ArraySize, 1, out);
+		fflush(out);
+	}
 
-    //Free remaining resources.
-    free(context_info_cper);
+	//Free remaining resources.
+	free(context_info_cper);
 }
 
 //Converts a single CPER-JSON IA32 register array into CPER binary, outputting to the given stream.
-void ir_ia32x64_ia32_registers_to_cper(json_object* registers, FILE* out)
+void ir_ia32x64_ia32_registers_to_cper(json_object *registers, FILE *out)
 {
-    EFI_CONTEXT_IA32_REGISTER_STATE register_state;
-    register_state.Eax = (UINT32)json_object_get_uint64(json_object_object_get(registers, "eax"));
-    register_state.Ebx = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ebx"));
-    register_state.Ecx = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ecx"));
-    register_state.Edx = (UINT32)json_object_get_uint64(json_object_object_get(registers, "edx"));
-    register_state.Esi = (UINT32)json_object_get_uint64(json_object_object_get(registers, "esi"));
-    register_state.Edi = (UINT32)json_object_get_uint64(json_object_object_get(registers, "edi"));
-    register_state.Ebp = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ebp"));
-    register_state.Esp = (UINT32)json_object_get_uint64(json_object_object_get(registers, "esp"));
-    register_state.Cs = (UINT16)json_object_get_uint64(json_object_object_get(registers, "cs"));
-    register_state.Ds = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ds"));
-    register_state.Ss = (UINT16)json_object_get_uint64(json_object_object_get(registers, "ss"));
-    register_state.Es = (UINT16)json_object_get_uint64(json_object_object_get(registers, "es"));
-    register_state.Fs = (UINT16)json_object_get_uint64(json_object_object_get(registers, "fs"));
-    register_state.Gs = (UINT16)json_object_get_uint64(json_object_object_get(registers, "gs"));
-    register_state.Eflags = (UINT32)json_object_get_uint64(json_object_object_get(registers, "eflags"));
-    register_state.Eip = (UINT32)json_object_get_uint64(json_object_object_get(registers, "eip"));
-    register_state.Cr0 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr0"));
-    register_state.Cr1 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr1"));
-    register_state.Cr2 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr2"));
-    register_state.Cr3 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr3"));
-    register_state.Cr4 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr4"));
+	EFI_CONTEXT_IA32_REGISTER_STATE register_state;
+	register_state.Eax = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "eax"));
+	register_state.Ebx = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "ebx"));
+	register_state.Ecx = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "ecx"));
+	register_state.Edx = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "edx"));
+	register_state.Esi = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "esi"));
+	register_state.Edi = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "edi"));
+	register_state.Ebp = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "ebp"));
+	register_state.Esp = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "esp"));
+	register_state.Cs = (UINT16)json_object_get_uint64(
+		json_object_object_get(registers, "cs"));
+	register_state.Ds = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "ds"));
+	register_state.Ss = (UINT16)json_object_get_uint64(
+		json_object_object_get(registers, "ss"));
+	register_state.Es = (UINT16)json_object_get_uint64(
+		json_object_object_get(registers, "es"));
+	register_state.Fs = (UINT16)json_object_get_uint64(
+		json_object_object_get(registers, "fs"));
+	register_state.Gs = (UINT16)json_object_get_uint64(
+		json_object_object_get(registers, "gs"));
+	register_state.Eflags = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "eflags"));
+	register_state.Eip = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "eip"));
+	register_state.Cr0 = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "cr0"));
+	register_state.Cr1 = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "cr1"));
+	register_state.Cr2 = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "cr2"));
+	register_state.Cr3 = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "cr3"));
+	register_state.Cr4 = (UINT32)json_object_get_uint64(
+		json_object_object_get(registers, "cr4"));
 
-    //64-bit registers are split into two 32-bit parts.
-    UINT64 gdtr = json_object_get_uint64(json_object_object_get(registers, "gdtr"));
-    register_state.Gdtr[0] = gdtr & 0xFFFFFFFF;
-    register_state.Gdtr[1] = gdtr >> 32;
-    UINT64 idtr = json_object_get_uint64(json_object_object_get(registers, "idtr"));
-    register_state.Idtr[0] = idtr & 0xFFFFFFFF;
-    register_state.Idtr[1] = idtr >> 32;
+	//64-bit registers are split into two 32-bit parts.
+	UINT64 gdtr = json_object_get_uint64(
+		json_object_object_get(registers, "gdtr"));
+	register_state.Gdtr[0] = gdtr & 0xFFFFFFFF;
+	register_state.Gdtr[1] = gdtr >> 32;
+	UINT64 idtr = json_object_get_uint64(
+		json_object_object_get(registers, "idtr"));
+	register_state.Idtr[0] = idtr & 0xFFFFFFFF;
+	register_state.Idtr[1] = idtr >> 32;
 
-    //16-bit registers.
-    register_state.Ldtr = (UINT16)json_object_get_uint64(json_object_object_get(registers, "ldtr"));
-    register_state.Tr = (UINT16)json_object_get_uint64(json_object_object_get(registers, "tr"));
+	//16-bit registers.
+	register_state.Ldtr = (UINT16)json_object_get_uint64(
+		json_object_object_get(registers, "ldtr"));
+	register_state.Tr = (UINT16)json_object_get_uint64(
+		json_object_object_get(registers, "tr"));
 
-    //Write out to stream.
-    fwrite(&register_state, sizeof(EFI_CONTEXT_IA32_REGISTER_STATE), 1, out);
-    fflush(out);
+	//Write out to stream.
+	fwrite(&register_state, sizeof(EFI_CONTEXT_IA32_REGISTER_STATE), 1,
+	       out);
+	fflush(out);
 }
 
 //Converts a single CPER-JSON x64 register array into CPER binary, outputting to the given stream.
-void ir_ia32x64_x64_registers_to_cper(json_object* registers, FILE* out)
+void ir_ia32x64_x64_registers_to_cper(json_object *registers, FILE *out)
 {
-    EFI_CONTEXT_X64_REGISTER_STATE register_state;
-    register_state.Rax = json_object_get_uint64(json_object_object_get(registers, "rax"));
-    register_state.Rbx = json_object_get_uint64(json_object_object_get(registers, "rbx"));
-    register_state.Rcx = json_object_get_uint64(json_object_object_get(registers, "rcx"));
-    register_state.Rdx = json_object_get_uint64(json_object_object_get(registers, "rdx"));
-    register_state.Rsi = json_object_get_uint64(json_object_object_get(registers, "rsi"));
-    register_state.Rdi = json_object_get_uint64(json_object_object_get(registers, "rdi"));
-    register_state.Rbp = json_object_get_uint64(json_object_object_get(registers, "rbp"));
-    register_state.Rsp = json_object_get_uint64(json_object_object_get(registers, "rsp"));
-    register_state.R8 = json_object_get_uint64(json_object_object_get(registers, "r8"));
-    register_state.R9 = json_object_get_uint64(json_object_object_get(registers, "r9"));
-    register_state.R10 = json_object_get_uint64(json_object_object_get(registers, "r10"));
-    register_state.R11 = json_object_get_uint64(json_object_object_get(registers, "r11"));
-    register_state.R12 = json_object_get_uint64(json_object_object_get(registers, "r12"));
-    register_state.R13 = json_object_get_uint64(json_object_object_get(registers, "r13"));
-    register_state.R14 = json_object_get_uint64(json_object_object_get(registers, "r14"));
-    register_state.R15 = json_object_get_uint64(json_object_object_get(registers, "r15"));
-    register_state.Cs = (UINT16)json_object_get_int(json_object_object_get(registers, "cs"));
-    register_state.Ds = (UINT16)json_object_get_int(json_object_object_get(registers, "ds"));
-    register_state.Ss = (UINT16)json_object_get_int(json_object_object_get(registers, "ss"));
-    register_state.Es = (UINT16)json_object_get_int(json_object_object_get(registers, "es"));
-    register_state.Fs = (UINT16)json_object_get_int(json_object_object_get(registers, "fs"));
-    register_state.Gs = (UINT16)json_object_get_int(json_object_object_get(registers, "gs"));
-    register_state.Resv1 = 0;
-    register_state.Rflags = json_object_get_uint64(json_object_object_get(registers, "rflags"));
-    register_state.Rip = json_object_get_uint64(json_object_object_get(registers, "eip"));
-    register_state.Cr0 = json_object_get_uint64(json_object_object_get(registers, "cr0"));
-    register_state.Cr1 = json_object_get_uint64(json_object_object_get(registers, "cr1"));
-    register_state.Cr2 = json_object_get_uint64(json_object_object_get(registers, "cr2"));
-    register_state.Cr3 = json_object_get_uint64(json_object_object_get(registers, "cr3"));
-    register_state.Cr4 = json_object_get_uint64(json_object_object_get(registers, "cr4"));
-    register_state.Cr8 = json_object_get_uint64(json_object_object_get(registers, "cr8"));
-    register_state.Gdtr[0] = json_object_get_uint64(json_object_object_get(registers, "gdtr_0"));
-    register_state.Gdtr[1] = json_object_get_uint64(json_object_object_get(registers, "gdtr_1"));
-    register_state.Idtr[0] = json_object_get_uint64(json_object_object_get(registers, "idtr_0"));
-    register_state.Idtr[1] = json_object_get_uint64(json_object_object_get(registers, "idtr_1"));
-    register_state.Ldtr = (UINT16)json_object_get_int(json_object_object_get(registers, "ldtr"));
-    register_state.Tr = (UINT16)json_object_get_int(json_object_object_get(registers, "tr"));
+	EFI_CONTEXT_X64_REGISTER_STATE register_state;
+	register_state.Rax = json_object_get_uint64(
+		json_object_object_get(registers, "rax"));
+	register_state.Rbx = json_object_get_uint64(
+		json_object_object_get(registers, "rbx"));
+	register_state.Rcx = json_object_get_uint64(
+		json_object_object_get(registers, "rcx"));
+	register_state.Rdx = json_object_get_uint64(
+		json_object_object_get(registers, "rdx"));
+	register_state.Rsi = json_object_get_uint64(
+		json_object_object_get(registers, "rsi"));
+	register_state.Rdi = json_object_get_uint64(
+		json_object_object_get(registers, "rdi"));
+	register_state.Rbp = json_object_get_uint64(
+		json_object_object_get(registers, "rbp"));
+	register_state.Rsp = json_object_get_uint64(
+		json_object_object_get(registers, "rsp"));
+	register_state.R8 =
+		json_object_get_uint64(json_object_object_get(registers, "r8"));
+	register_state.R9 =
+		json_object_get_uint64(json_object_object_get(registers, "r9"));
+	register_state.R10 = json_object_get_uint64(
+		json_object_object_get(registers, "r10"));
+	register_state.R11 = json_object_get_uint64(
+		json_object_object_get(registers, "r11"));
+	register_state.R12 = json_object_get_uint64(
+		json_object_object_get(registers, "r12"));
+	register_state.R13 = json_object_get_uint64(
+		json_object_object_get(registers, "r13"));
+	register_state.R14 = json_object_get_uint64(
+		json_object_object_get(registers, "r14"));
+	register_state.R15 = json_object_get_uint64(
+		json_object_object_get(registers, "r15"));
+	register_state.Cs = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "cs"));
+	register_state.Ds = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "ds"));
+	register_state.Ss = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "ss"));
+	register_state.Es = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "es"));
+	register_state.Fs = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "fs"));
+	register_state.Gs = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "gs"));
+	register_state.Resv1 = 0;
+	register_state.Rflags = json_object_get_uint64(
+		json_object_object_get(registers, "rflags"));
+	register_state.Rip = json_object_get_uint64(
+		json_object_object_get(registers, "eip"));
+	register_state.Cr0 = json_object_get_uint64(
+		json_object_object_get(registers, "cr0"));
+	register_state.Cr1 = json_object_get_uint64(
+		json_object_object_get(registers, "cr1"));
+	register_state.Cr2 = json_object_get_uint64(
+		json_object_object_get(registers, "cr2"));
+	register_state.Cr3 = json_object_get_uint64(
+		json_object_object_get(registers, "cr3"));
+	register_state.Cr4 = json_object_get_uint64(
+		json_object_object_get(registers, "cr4"));
+	register_state.Cr8 = json_object_get_uint64(
+		json_object_object_get(registers, "cr8"));
+	register_state.Gdtr[0] = json_object_get_uint64(
+		json_object_object_get(registers, "gdtr_0"));
+	register_state.Gdtr[1] = json_object_get_uint64(
+		json_object_object_get(registers, "gdtr_1"));
+	register_state.Idtr[0] = json_object_get_uint64(
+		json_object_object_get(registers, "idtr_0"));
+	register_state.Idtr[1] = json_object_get_uint64(
+		json_object_object_get(registers, "idtr_1"));
+	register_state.Ldtr = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "ldtr"));
+	register_state.Tr = (UINT16)json_object_get_int(
+		json_object_object_get(registers, "tr"));
 
-    //Write out to stream.
-    fwrite(&register_state, sizeof(EFI_CONTEXT_X64_REGISTER_STATE), 1, out);
-    fflush(out);
+	//Write out to stream.
+	fwrite(&register_state, sizeof(EFI_CONTEXT_X64_REGISTER_STATE), 1, out);
+	fflush(out);
 }
\ No newline at end of file
diff --git a/sections/cper-section-ipf.c b/sections/cper-section-ipf.c
index 0c065cc..b014d5d 100644
--- a/sections/cper-section-ipf.c
+++ b/sections/cper-section-ipf.c
@@ -10,99 +10,159 @@
 #include "../cper-utils.h"
 #include "cper-section-ipf.h"
 
-json_object* cper_ipf_mod_error_read_array(EFI_IPF_MOD_ERROR_INFO** cur_error, int num_to_read);
-json_object* cper_ipf_mod_error_to_ir(EFI_IPF_MOD_ERROR_INFO* mod_error);
+json_object *cper_ipf_mod_error_read_array(EFI_IPF_MOD_ERROR_INFO **cur_error,
+					   int num_to_read);
+json_object *cper_ipf_mod_error_to_ir(EFI_IPF_MOD_ERROR_INFO *mod_error);
 
 //Converts a single Intel IPF error CPER section into JSON IR.
-json_object* cper_section_ipf_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *cper_section_ipf_to_ir(void *section,
+				    EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_IPF_ERROR_INFO_HEADER* ipf_error = (EFI_IPF_ERROR_INFO_HEADER*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_IPF_ERROR_INFO_HEADER *ipf_error =
+		(EFI_IPF_ERROR_INFO_HEADER *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = json_object_new_object();
-    json_object_object_add(validation, "errorMapValid", json_object_new_boolean(ipf_error->ValidBits.ProcErrorMapValid));
-    json_object_object_add(validation, "stateParameterValid", json_object_new_boolean(ipf_error->ValidBits.ProcErrorMapValid));
-    json_object_object_add(validation, "crLIDValid", json_object_new_boolean(ipf_error->ValidBits.ProcCrLidValid));
-    json_object_object_add(validation, "psiStaticStructValid", json_object_new_boolean(ipf_error->ValidBits.PsiStaticStructValid));
-    json_object_object_add(validation, "cpuInfoValid", json_object_new_boolean(ipf_error->ValidBits.CpuIdInfoValid));
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation = json_object_new_object();
+	json_object_object_add(validation, "errorMapValid",
+			       json_object_new_boolean(
+				       ipf_error->ValidBits.ProcErrorMapValid));
+	json_object_object_add(validation, "stateParameterValid",
+			       json_object_new_boolean(
+				       ipf_error->ValidBits.ProcErrorMapValid));
+	json_object_object_add(
+		validation, "crLIDValid",
+		json_object_new_boolean(ipf_error->ValidBits.ProcCrLidValid));
+	json_object_object_add(
+		validation, "psiStaticStructValid",
+		json_object_new_boolean(
+			ipf_error->ValidBits.PsiStaticStructValid));
+	json_object_object_add(
+		validation, "cpuInfoValid",
+		json_object_new_boolean(ipf_error->ValidBits.CpuIdInfoValid));
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Numbers of various variable length segments.
-    json_object_object_add(section_ir, "cacheCheckNum", json_object_new_uint64(ipf_error->ValidBits.CacheCheckNum));
-    json_object_object_add(section_ir, "tlbCheckNum", json_object_new_uint64(ipf_error->ValidBits.TlbCheckNum));
-    json_object_object_add(section_ir, "busCheckNum", json_object_new_uint64(ipf_error->ValidBits.BusCheckNum));
-    json_object_object_add(section_ir, "regFileCheckNum", json_object_new_uint64(ipf_error->ValidBits.RegFileCheckNum));
-    json_object_object_add(section_ir, "msCheckNum", json_object_new_uint64(ipf_error->ValidBits.MsCheckNum));
+	//Numbers of various variable length segments.
+	json_object_object_add(
+		section_ir, "cacheCheckNum",
+		json_object_new_uint64(ipf_error->ValidBits.CacheCheckNum));
+	json_object_object_add(
+		section_ir, "tlbCheckNum",
+		json_object_new_uint64(ipf_error->ValidBits.TlbCheckNum));
+	json_object_object_add(
+		section_ir, "busCheckNum",
+		json_object_new_uint64(ipf_error->ValidBits.BusCheckNum));
+	json_object_object_add(
+		section_ir, "regFileCheckNum",
+		json_object_new_uint64(ipf_error->ValidBits.RegFileCheckNum));
+	json_object_object_add(
+		section_ir, "msCheckNum",
+		json_object_new_uint64(ipf_error->ValidBits.MsCheckNum));
 
-    //Process error map, state params/CR LID.
-    json_object_object_add(section_ir, "procErrorMap", json_object_new_uint64(ipf_error->ProcErrorMap));
-    json_object_object_add(section_ir, "procStateParameter", json_object_new_uint64(ipf_error->ProcStateParameter));
-    json_object_object_add(section_ir, "procCRLID", json_object_new_uint64(ipf_error->ProcCrLid));
+	//Process error map, state params/CR LID.
+	json_object_object_add(section_ir, "procErrorMap",
+			       json_object_new_uint64(ipf_error->ProcErrorMap));
+	json_object_object_add(
+		section_ir, "procStateParameter",
+		json_object_new_uint64(ipf_error->ProcStateParameter));
+	json_object_object_add(section_ir, "procCRLID",
+			       json_object_new_uint64(ipf_error->ProcCrLid));
 
-    //Read cache, TLB, bus, register file, MS errors.
-    EFI_IPF_MOD_ERROR_INFO* cur_error = (EFI_IPF_MOD_ERROR_INFO*)(ipf_error + 1);
-    json_object_object_add(section_ir, "cacheErrors", cper_ipf_mod_error_read_array(&cur_error, ipf_error->ValidBits.CacheCheckNum));
-    json_object_object_add(section_ir, "tlbErrors", cper_ipf_mod_error_read_array(&cur_error, ipf_error->ValidBits.TlbCheckNum));
-    json_object_object_add(section_ir, "busErrors", cper_ipf_mod_error_read_array(&cur_error, ipf_error->ValidBits.BusCheckNum));
-    json_object_object_add(section_ir, "regFileErrors", cper_ipf_mod_error_read_array(&cur_error, ipf_error->ValidBits.RegFileCheckNum));
-    json_object_object_add(section_ir, "msErrors", cper_ipf_mod_error_read_array(&cur_error, ipf_error->ValidBits.MsCheckNum));
-    
-    //CPU ID information.
-    EFI_IPF_CPU_INFO* cpu_info = (EFI_IPF_CPU_INFO*)cur_error;
-    //stretch: find out how this is represented
+	//Read cache, TLB, bus, register file, MS errors.
+	EFI_IPF_MOD_ERROR_INFO *cur_error =
+		(EFI_IPF_MOD_ERROR_INFO *)(ipf_error + 1);
+	json_object_object_add(section_ir, "cacheErrors",
+			       cper_ipf_mod_error_read_array(
+				       &cur_error,
+				       ipf_error->ValidBits.CacheCheckNum));
+	json_object_object_add(section_ir, "tlbErrors",
+			       cper_ipf_mod_error_read_array(
+				       &cur_error,
+				       ipf_error->ValidBits.TlbCheckNum));
+	json_object_object_add(section_ir, "busErrors",
+			       cper_ipf_mod_error_read_array(
+				       &cur_error,
+				       ipf_error->ValidBits.BusCheckNum));
+	json_object_object_add(section_ir, "regFileErrors",
+			       cper_ipf_mod_error_read_array(
+				       &cur_error,
+				       ipf_error->ValidBits.RegFileCheckNum));
+	json_object_object_add(
+		section_ir, "msErrors",
+		cper_ipf_mod_error_read_array(&cur_error,
+					      ipf_error->ValidBits.MsCheckNum));
 
-    //Processor static information.
-    EFI_IPF_PSI_STATIC* psi_static = (EFI_IPF_PSI_STATIC*)(cpu_info + 1);
-    json_object* psi_static_ir = json_object_new_object();
-    
-    //PSI validation bits.
-    json_object* psi_validation = bitfield_to_ir(psi_static->ValidBits, 6, IPF_PSI_STATIC_INFO_VALID_BITFIELD_NAMES);
-    json_object_object_add(psi_static_ir, "validationBits", psi_validation);
+	//CPU ID information.
+	EFI_IPF_CPU_INFO *cpu_info = (EFI_IPF_CPU_INFO *)cur_error;
+	//stretch: find out how this is represented
 
-    //PSI minimal state save info.
-    //stretch: structure min save state area as in Intel Itanium Architecture Software Developer's Manual.
+	//Processor static information.
+	EFI_IPF_PSI_STATIC *psi_static = (EFI_IPF_PSI_STATIC *)(cpu_info + 1);
+	json_object *psi_static_ir = json_object_new_object();
 
-    //BRs, CRs, ARs, RRs, FRs.
-    json_object_object_add(psi_static_ir, "brs", uint64_array_to_ir_array(psi_static->Brs, 8));
-    json_object_object_add(psi_static_ir, "crs", uint64_array_to_ir_array(psi_static->Crs, 128));
-    json_object_object_add(psi_static_ir, "ars", uint64_array_to_ir_array(psi_static->Ars, 128));
-    json_object_object_add(psi_static_ir, "rrs", uint64_array_to_ir_array(psi_static->Rrs, 8));
-    json_object_object_add(psi_static_ir, "frs", uint64_array_to_ir_array(psi_static->Frs, 256));
-    json_object_object_add(section_ir, "psiStaticInfo", psi_static_ir);
+	//PSI validation bits.
+	json_object *psi_validation =
+		bitfield_to_ir(psi_static->ValidBits, 6,
+			       IPF_PSI_STATIC_INFO_VALID_BITFIELD_NAMES);
+	json_object_object_add(psi_static_ir, "validationBits", psi_validation);
 
-    return section_ir;
+	//PSI minimal state save info.
+	//stretch: structure min save state area as in Intel Itanium Architecture Software Developer's Manual.
+
+	//BRs, CRs, ARs, RRs, FRs.
+	json_object_object_add(psi_static_ir, "brs",
+			       uint64_array_to_ir_array(psi_static->Brs, 8));
+	json_object_object_add(psi_static_ir, "crs",
+			       uint64_array_to_ir_array(psi_static->Crs, 128));
+	json_object_object_add(psi_static_ir, "ars",
+			       uint64_array_to_ir_array(psi_static->Ars, 128));
+	json_object_object_add(psi_static_ir, "rrs",
+			       uint64_array_to_ir_array(psi_static->Rrs, 8));
+	json_object_object_add(psi_static_ir, "frs",
+			       uint64_array_to_ir_array(psi_static->Frs, 256));
+	json_object_object_add(section_ir, "psiStaticInfo", psi_static_ir);
+
+	return section_ir;
 }
 
 //Reads a continuous stream of CPER IPF mod errors beginning from the given pointer, for n entries.
 //Returns an array containing all read entries as JSON IR.
-json_object* cper_ipf_mod_error_read_array(EFI_IPF_MOD_ERROR_INFO** cur_error, int num_to_read)
+json_object *cper_ipf_mod_error_read_array(EFI_IPF_MOD_ERROR_INFO **cur_error,
+					   int num_to_read)
 {
-    json_object* error_array = json_object_new_array();
-    for (int i=0; i<num_to_read; i++)
-    {
-        json_object_array_add(error_array, cper_ipf_mod_error_to_ir(*cur_error));
-        *cur_error = *cur_error + 1;
-    }
+	json_object *error_array = json_object_new_array();
+	for (int i = 0; i < num_to_read; i++) {
+		json_object_array_add(error_array,
+				      cper_ipf_mod_error_to_ir(*cur_error));
+		*cur_error = *cur_error + 1;
+	}
 
-    return error_array;
+	return error_array;
 }
 
 //Converts a single CPER IPF mod error info structure into JSON IR.
-json_object* cper_ipf_mod_error_to_ir(EFI_IPF_MOD_ERROR_INFO* mod_error)
+json_object *cper_ipf_mod_error_to_ir(EFI_IPF_MOD_ERROR_INFO *mod_error)
 {
-    json_object* mod_error_ir = json_object_new_object();
-    
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(mod_error->ValidBits, 5, IPF_MOD_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(mod_error_ir, "validationBits", validation);
+	json_object *mod_error_ir = json_object_new_object();
 
-    //Numeric fields.
-    json_object_object_add(mod_error_ir, "modCheckInfo", json_object_new_uint64(mod_error->ModCheckInfo));
-    json_object_object_add(mod_error_ir, "modTargetID", json_object_new_uint64(mod_error->ModTargetId));
-    json_object_object_add(mod_error_ir, "modRequestorID", json_object_new_uint64(mod_error->ModRequestorId));
-    json_object_object_add(mod_error_ir, "modResponderID", json_object_new_uint64(mod_error->ModResponderId));
-    json_object_object_add(mod_error_ir, "modPreciseIP", json_object_new_uint64(mod_error->ModPreciseIp));
+	//Validation bits.
+	json_object *validation = bitfield_to_ir(
+		mod_error->ValidBits, 5, IPF_MOD_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(mod_error_ir, "validationBits", validation);
 
-    return mod_error_ir;
+	//Numeric fields.
+	json_object_object_add(mod_error_ir, "modCheckInfo",
+			       json_object_new_uint64(mod_error->ModCheckInfo));
+	json_object_object_add(mod_error_ir, "modTargetID",
+			       json_object_new_uint64(mod_error->ModTargetId));
+	json_object_object_add(
+		mod_error_ir, "modRequestorID",
+		json_object_new_uint64(mod_error->ModRequestorId));
+	json_object_object_add(
+		mod_error_ir, "modResponderID",
+		json_object_new_uint64(mod_error->ModResponderId));
+	json_object_object_add(mod_error_ir, "modPreciseIP",
+			       json_object_new_uint64(mod_error->ModPreciseIp));
+
+	return mod_error_ir;
 }
\ No newline at end of file
diff --git a/sections/cper-section-memory.c b/sections/cper-section-memory.c
index 8cd7f0b..af507fd 100644
--- a/sections/cper-section-memory.c
+++ b/sections/cper-section-memory.c
@@ -11,240 +11,363 @@
 #include "cper-section-memory.h"
 
 //Converts a single memory error CPER section into JSON IR.
-json_object* cper_section_platform_memory_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_platform_memory_to_ir(void *section,
+				   EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_PLATFORM_MEMORY_ERROR_DATA* memory_error = (EFI_PLATFORM_MEMORY_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_PLATFORM_MEMORY_ERROR_DATA *memory_error =
+		(EFI_PLATFORM_MEMORY_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bitfield.
-    json_object* validation = bitfield_to_ir(memory_error->ValidFields, 22, MEMORY_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bitfield.
+	json_object *validation =
+		bitfield_to_ir(memory_error->ValidFields, 22,
+			       MEMORY_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Error status.
-    json_object* error_status = cper_generic_error_status_to_ir(&memory_error->ErrorStatus);
-    json_object_object_add(section_ir, "errorStatus", error_status);
+	//Error status.
+	json_object *error_status =
+		cper_generic_error_status_to_ir(&memory_error->ErrorStatus);
+	json_object_object_add(section_ir, "errorStatus", error_status);
 
-    //Bank.
-    json_object* bank = json_object_new_object();
-    if ((memory_error->ValidFields >> 5) & 0x1)
-    {
-        //Entire bank address mode.
-        json_object_object_add(bank, "value", json_object_new_uint64(memory_error->Bank));
-    }
-    else 
-    {
-        //Address/group address mode.
-        json_object_object_add(bank, "address", json_object_new_uint64(memory_error->Bank & 0xFF));
-        json_object_object_add(bank, "group", json_object_new_uint64(memory_error->Bank >> 8));
-    }
-    json_object_object_add(section_ir, "bank", bank);
+	//Bank.
+	json_object *bank = json_object_new_object();
+	if ((memory_error->ValidFields >> 5) & 0x1) {
+		//Entire bank address mode.
+		json_object_object_add(
+			bank, "value",
+			json_object_new_uint64(memory_error->Bank));
+	} else {
+		//Address/group address mode.
+		json_object_object_add(
+			bank, "address",
+			json_object_new_uint64(memory_error->Bank & 0xFF));
+		json_object_object_add(
+			bank, "group",
+			json_object_new_uint64(memory_error->Bank >> 8));
+	}
+	json_object_object_add(section_ir, "bank", bank);
 
-    //Memory error type.
-    json_object* memory_error_type = integer_to_readable_pair(memory_error->ErrorType, 16,
-        MEMORY_ERROR_TYPES_KEYS,
-        MEMORY_ERROR_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "memoryErrorType", memory_error_type);
+	//Memory error type.
+	json_object *memory_error_type = integer_to_readable_pair(
+		memory_error->ErrorType, 16, MEMORY_ERROR_TYPES_KEYS,
+		MEMORY_ERROR_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "memoryErrorType",
+			       memory_error_type);
 
-    //"Extended" row/column indication field + misc.
-    json_object* extended = json_object_new_object();
-    json_object_object_add(extended, "rowBit16", json_object_new_boolean(memory_error->Extended & 0b1));
-    json_object_object_add(extended, "rowBit17", json_object_new_boolean((memory_error->Extended >> 1) & 0b1));
-    json_object_object_add(extended, "chipIdentification", json_object_new_int(memory_error->Extended >> 5));
-    json_object_object_add(section_ir, "extended", extended);
+	//"Extended" row/column indication field + misc.
+	json_object *extended = json_object_new_object();
+	json_object_object_add(extended, "rowBit16",
+			       json_object_new_boolean(memory_error->Extended &
+						       0b1));
+	json_object_object_add(
+		extended, "rowBit17",
+		json_object_new_boolean((memory_error->Extended >> 1) & 0b1));
+	json_object_object_add(extended, "chipIdentification",
+			       json_object_new_int(memory_error->Extended >>
+						   5));
+	json_object_object_add(section_ir, "extended", extended);
 
-    //Miscellaneous numeric fields.
-    json_object_object_add(section_ir, "physicalAddress", json_object_new_uint64(memory_error->PhysicalAddress));
-    json_object_object_add(section_ir, "physicalAddressMask", json_object_new_uint64(memory_error->PhysicalAddressMask));
-    json_object_object_add(section_ir, "node", json_object_new_uint64(memory_error->Node));
-    json_object_object_add(section_ir, "card", json_object_new_uint64(memory_error->Card));
-    json_object_object_add(section_ir, "moduleRank", json_object_new_uint64(memory_error->ModuleRank));
-    json_object_object_add(section_ir, "device", json_object_new_uint64(memory_error->Device));
-    json_object_object_add(section_ir, "row", json_object_new_uint64(memory_error->Row));
-    json_object_object_add(section_ir, "column", json_object_new_uint64(memory_error->Column));
-    json_object_object_add(section_ir, "bitPosition", json_object_new_uint64(memory_error->BitPosition));
-    json_object_object_add(section_ir, "requestorID", json_object_new_uint64(memory_error->RequestorId));
-    json_object_object_add(section_ir, "responderID", json_object_new_uint64(memory_error->ResponderId));
-    json_object_object_add(section_ir, "targetID", json_object_new_uint64(memory_error->TargetId));
-    json_object_object_add(section_ir, "rankNumber", json_object_new_uint64(memory_error->RankNum));
-    json_object_object_add(section_ir, "cardSmbiosHandle", json_object_new_uint64(memory_error->CardHandle));
-    json_object_object_add(section_ir, "moduleSmbiosHandle", json_object_new_uint64(memory_error->ModuleHandle));
+	//Miscellaneous numeric fields.
+	json_object_object_add(
+		section_ir, "physicalAddress",
+		json_object_new_uint64(memory_error->PhysicalAddress));
+	json_object_object_add(
+		section_ir, "physicalAddressMask",
+		json_object_new_uint64(memory_error->PhysicalAddressMask));
+	json_object_object_add(section_ir, "node",
+			       json_object_new_uint64(memory_error->Node));
+	json_object_object_add(section_ir, "card",
+			       json_object_new_uint64(memory_error->Card));
+	json_object_object_add(
+		section_ir, "moduleRank",
+		json_object_new_uint64(memory_error->ModuleRank));
+	json_object_object_add(section_ir, "device",
+			       json_object_new_uint64(memory_error->Device));
+	json_object_object_add(section_ir, "row",
+			       json_object_new_uint64(memory_error->Row));
+	json_object_object_add(section_ir, "column",
+			       json_object_new_uint64(memory_error->Column));
+	json_object_object_add(
+		section_ir, "bitPosition",
+		json_object_new_uint64(memory_error->BitPosition));
+	json_object_object_add(
+		section_ir, "requestorID",
+		json_object_new_uint64(memory_error->RequestorId));
+	json_object_object_add(
+		section_ir, "responderID",
+		json_object_new_uint64(memory_error->ResponderId));
+	json_object_object_add(section_ir, "targetID",
+			       json_object_new_uint64(memory_error->TargetId));
+	json_object_object_add(section_ir, "rankNumber",
+			       json_object_new_uint64(memory_error->RankNum));
+	json_object_object_add(
+		section_ir, "cardSmbiosHandle",
+		json_object_new_uint64(memory_error->CardHandle));
+	json_object_object_add(
+		section_ir, "moduleSmbiosHandle",
+		json_object_new_uint64(memory_error->ModuleHandle));
 
-    return section_ir;
+	return section_ir;
 }
 
 //Converts a single memory error 2 CPER section into JSON IR.
-json_object* cper_section_platform_memory2_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_platform_memory2_to_ir(void *section,
+				    EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_PLATFORM_MEMORY2_ERROR_DATA* memory_error = (EFI_PLATFORM_MEMORY2_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_PLATFORM_MEMORY2_ERROR_DATA *memory_error =
+		(EFI_PLATFORM_MEMORY2_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(memory_error->ValidFields, 22, MEMORY_ERROR_2_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation =
+		bitfield_to_ir(memory_error->ValidFields, 22,
+			       MEMORY_ERROR_2_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Error status.
-    json_object* error_status = cper_generic_error_status_to_ir(&memory_error->ErrorStatus);
-    json_object_object_add(section_ir, "errorStatus", error_status);
+	//Error status.
+	json_object *error_status =
+		cper_generic_error_status_to_ir(&memory_error->ErrorStatus);
+	json_object_object_add(section_ir, "errorStatus", error_status);
 
-    //Bank.
-    json_object* bank = json_object_new_object();
-    if ((memory_error->ValidFields >> 5) & 0x1)
-    {
-        //Entire bank address mode.
-        json_object_object_add(bank, "value", json_object_new_uint64(memory_error->Bank));
-    }
-    else 
-    {
-        //Address/group address mode.
-        json_object_object_add(bank, "address", json_object_new_uint64(memory_error->Bank & 0xFF));
-        json_object_object_add(bank, "group", json_object_new_uint64(memory_error->Bank >> 8));
-    }
-    json_object_object_add(section_ir, "bank", bank);
+	//Bank.
+	json_object *bank = json_object_new_object();
+	if ((memory_error->ValidFields >> 5) & 0x1) {
+		//Entire bank address mode.
+		json_object_object_add(
+			bank, "value",
+			json_object_new_uint64(memory_error->Bank));
+	} else {
+		//Address/group address mode.
+		json_object_object_add(
+			bank, "address",
+			json_object_new_uint64(memory_error->Bank & 0xFF));
+		json_object_object_add(
+			bank, "group",
+			json_object_new_uint64(memory_error->Bank >> 8));
+	}
+	json_object_object_add(section_ir, "bank", bank);
 
-    //Memory error type.
-    json_object* memory_error_type = integer_to_readable_pair(memory_error->MemErrorType, 16,
-        MEMORY_ERROR_TYPES_KEYS,
-        MEMORY_ERROR_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "memoryErrorType", memory_error_type);
+	//Memory error type.
+	json_object *memory_error_type = integer_to_readable_pair(
+		memory_error->MemErrorType, 16, MEMORY_ERROR_TYPES_KEYS,
+		MEMORY_ERROR_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "memoryErrorType",
+			       memory_error_type);
 
-    //Status.
-    json_object* status = json_object_new_object();
-    json_object_object_add(status, "value", json_object_new_int(memory_error->Status));
-    json_object_object_add(status, "state", json_object_new_string(memory_error->Status & 0b1 == 0 ? "Corrected" : "Uncorrected"));
-    json_object_object_add(section_ir, "status", status);
+	//Status.
+	json_object *status = json_object_new_object();
+	json_object_object_add(status, "value",
+			       json_object_new_int(memory_error->Status));
+	json_object_object_add(status, "state",
+			       json_object_new_string(memory_error->Status &
+								      0b1 == 0 ?
+								    "Corrected" :
+								    "Uncorrected"));
+	json_object_object_add(section_ir, "status", status);
 
-    //Miscellaneous numeric fields.
-    json_object_object_add(section_ir, "physicalAddress", json_object_new_uint64(memory_error->PhysicalAddress));
-    json_object_object_add(section_ir, "physicalAddressMask", json_object_new_uint64(memory_error->PhysicalAddressMask));
-    json_object_object_add(section_ir, "node", json_object_new_uint64(memory_error->Node));
-    json_object_object_add(section_ir, "card", json_object_new_uint64(memory_error->Card));
-    json_object_object_add(section_ir, "module", json_object_new_uint64(memory_error->Module));
-    json_object_object_add(section_ir, "device", json_object_new_uint64(memory_error->Device));
-    json_object_object_add(section_ir, "row", json_object_new_uint64(memory_error->Row));
-    json_object_object_add(section_ir, "column", json_object_new_uint64(memory_error->Column));
-    json_object_object_add(section_ir, "rank", json_object_new_uint64(memory_error->Rank));
-    json_object_object_add(section_ir, "bitPosition", json_object_new_uint64(memory_error->BitPosition));
-    json_object_object_add(section_ir, "chipID", json_object_new_uint64(memory_error->ChipId));
-    json_object_object_add(section_ir, "requestorID", json_object_new_uint64(memory_error->RequestorId));
-    json_object_object_add(section_ir, "responderID", json_object_new_uint64(memory_error->ResponderId));
-    json_object_object_add(section_ir, "targetID", json_object_new_uint64(memory_error->TargetId));
-    json_object_object_add(section_ir, "cardSmbiosHandle", json_object_new_uint64(memory_error->CardHandle));
-    json_object_object_add(section_ir, "moduleSmbiosHandle", json_object_new_uint64(memory_error->ModuleHandle));
-    
-    return section_ir;
+	//Miscellaneous numeric fields.
+	json_object_object_add(
+		section_ir, "physicalAddress",
+		json_object_new_uint64(memory_error->PhysicalAddress));
+	json_object_object_add(
+		section_ir, "physicalAddressMask",
+		json_object_new_uint64(memory_error->PhysicalAddressMask));
+	json_object_object_add(section_ir, "node",
+			       json_object_new_uint64(memory_error->Node));
+	json_object_object_add(section_ir, "card",
+			       json_object_new_uint64(memory_error->Card));
+	json_object_object_add(section_ir, "module",
+			       json_object_new_uint64(memory_error->Module));
+	json_object_object_add(section_ir, "device",
+			       json_object_new_uint64(memory_error->Device));
+	json_object_object_add(section_ir, "row",
+			       json_object_new_uint64(memory_error->Row));
+	json_object_object_add(section_ir, "column",
+			       json_object_new_uint64(memory_error->Column));
+	json_object_object_add(section_ir, "rank",
+			       json_object_new_uint64(memory_error->Rank));
+	json_object_object_add(
+		section_ir, "bitPosition",
+		json_object_new_uint64(memory_error->BitPosition));
+	json_object_object_add(section_ir, "chipID",
+			       json_object_new_uint64(memory_error->ChipId));
+	json_object_object_add(
+		section_ir, "requestorID",
+		json_object_new_uint64(memory_error->RequestorId));
+	json_object_object_add(
+		section_ir, "responderID",
+		json_object_new_uint64(memory_error->ResponderId));
+	json_object_object_add(section_ir, "targetID",
+			       json_object_new_uint64(memory_error->TargetId));
+	json_object_object_add(
+		section_ir, "cardSmbiosHandle",
+		json_object_new_uint64(memory_error->CardHandle));
+	json_object_object_add(
+		section_ir, "moduleSmbiosHandle",
+		json_object_new_uint64(memory_error->ModuleHandle));
+
+	return section_ir;
 }
 
 //Converts a single Memory Error IR section into CPER binary, outputting to the provided stream.
-void ir_section_memory_to_cper(json_object* section, FILE* out)
+void ir_section_memory_to_cper(json_object *section, FILE *out)
 {
-    EFI_PLATFORM_MEMORY_ERROR_DATA* section_cper = 
-        (EFI_PLATFORM_MEMORY_ERROR_DATA*)calloc(1, sizeof(EFI_PLATFORM_MEMORY_ERROR_DATA));
+	EFI_PLATFORM_MEMORY_ERROR_DATA *section_cper =
+		(EFI_PLATFORM_MEMORY_ERROR_DATA *)calloc(
+			1, sizeof(EFI_PLATFORM_MEMORY_ERROR_DATA));
 
-    //Validation bits.
-    section_cper->ValidFields = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        22, MEMORY_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 22,
+		MEMORY_ERROR_VALID_BITFIELD_NAMES);
 
-    //Error status.
-    ir_generic_error_status_to_cper(json_object_object_get(section, "errorStatus"), &section_cper->ErrorStatus);
+	//Error status.
+	ir_generic_error_status_to_cper(json_object_object_get(section,
+							       "errorStatus"),
+					&section_cper->ErrorStatus);
 
-    //Bank.
-    json_object* bank = json_object_object_get(section, "bank");
-    if ((section_cper->ValidFields >> 5) & 0x1)
-    {
-        //Bank just uses simple address.
-        section_cper->Bank = (UINT16)json_object_get_uint64(json_object_object_get(bank, "value"));
-    }
-    else
-    {
-        //Bank uses address/group style address.
-        UINT16 address = (UINT8)json_object_get_uint64(json_object_object_get(bank, "address"));
-        UINT16 group = (UINT8)json_object_get_uint64(json_object_object_get(bank, "group"));
-        section_cper->Bank = address + (group << 8);
-    }
+	//Bank.
+	json_object *bank = json_object_object_get(section, "bank");
+	if ((section_cper->ValidFields >> 5) & 0x1) {
+		//Bank just uses simple address.
+		section_cper->Bank = (UINT16)json_object_get_uint64(
+			json_object_object_get(bank, "value"));
+	} else {
+		//Bank uses address/group style address.
+		UINT16 address = (UINT8)json_object_get_uint64(
+			json_object_object_get(bank, "address"));
+		UINT16 group = (UINT8)json_object_get_uint64(
+			json_object_object_get(bank, "group"));
+		section_cper->Bank = address + (group << 8);
+	}
 
-    //"Extended" field.
-    json_object* extended = json_object_object_get(section, "extended");
-    section_cper->Extended = 0;
-    section_cper->Extended |= json_object_get_boolean(json_object_object_get(extended, "rowBit16"));
-    section_cper->Extended |= json_object_get_boolean(json_object_object_get(extended, "rowBit17")) << 1;
-    section_cper->Extended |= json_object_get_int(json_object_object_get(extended, "chipIdentification")) << 5;
+	//"Extended" field.
+	json_object *extended = json_object_object_get(section, "extended");
+	section_cper->Extended = 0;
+	section_cper->Extended |= json_object_get_boolean(
+		json_object_object_get(extended, "rowBit16"));
+	section_cper->Extended |=
+		json_object_get_boolean(
+			json_object_object_get(extended, "rowBit17"))
+		<< 1;
+	section_cper->Extended |= json_object_get_int(json_object_object_get(
+					  extended, "chipIdentification"))
+				  << 5;
 
-    //Miscellaneous value fields.
-    section_cper->ErrorType = (UINT8)readable_pair_to_integer(json_object_object_get(section, "memoryErrorType"));
-    section_cper->PhysicalAddress = json_object_get_uint64(json_object_object_get(section, "physicalAddress"));
-    section_cper->PhysicalAddressMask = json_object_get_uint64(json_object_object_get(section, "physicalAddressMask"));
-    section_cper->Node = (UINT16)json_object_get_uint64(json_object_object_get(section, "node"));
-    section_cper->Card = (UINT16)json_object_get_uint64(json_object_object_get(section, "card"));
-    section_cper->ModuleRank = (UINT16)json_object_get_uint64(json_object_object_get(section, "moduleRank"));
-    section_cper->Device = (UINT16)json_object_get_uint64(json_object_object_get(section, "device"));
-    section_cper->Row = (UINT16)json_object_get_uint64(json_object_object_get(section, "row"));
-    section_cper->Column = (UINT16)json_object_get_uint64(json_object_object_get(section, "column"));
-    section_cper->BitPosition = (UINT16)json_object_get_uint64(json_object_object_get(section, "bitPosition"));
-    section_cper->RequestorId = json_object_get_uint64(json_object_object_get(section, "requestorID"));
-    section_cper->ResponderId = json_object_get_uint64(json_object_object_get(section, "responderID"));
-    section_cper->TargetId = json_object_get_uint64(json_object_object_get(section, "targetID"));
-    section_cper->RankNum = (UINT16)json_object_get_uint64(json_object_object_get(section, "rankNumber"));
-    section_cper->CardHandle = (UINT16)json_object_get_uint64(json_object_object_get(section, "cardSmbiosHandle"));
-    section_cper->ModuleHandle = (UINT16)json_object_get_uint64(json_object_object_get(section, "moduleSmbiosHandle"));
+	//Miscellaneous value fields.
+	section_cper->ErrorType = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "memoryErrorType"));
+	section_cper->PhysicalAddress = json_object_get_uint64(
+		json_object_object_get(section, "physicalAddress"));
+	section_cper->PhysicalAddressMask = json_object_get_uint64(
+		json_object_object_get(section, "physicalAddressMask"));
+	section_cper->Node = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "node"));
+	section_cper->Card = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "card"));
+	section_cper->ModuleRank = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "moduleRank"));
+	section_cper->Device = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "device"));
+	section_cper->Row = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "row"));
+	section_cper->Column = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "column"));
+	section_cper->BitPosition = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "bitPosition"));
+	section_cper->RequestorId = json_object_get_uint64(
+		json_object_object_get(section, "requestorID"));
+	section_cper->ResponderId = json_object_get_uint64(
+		json_object_object_get(section, "responderID"));
+	section_cper->TargetId = json_object_get_uint64(
+		json_object_object_get(section, "targetID"));
+	section_cper->RankNum = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "rankNumber"));
+	section_cper->CardHandle = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "cardSmbiosHandle"));
+	section_cper->ModuleHandle = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "moduleSmbiosHandle"));
 
-    //Write to stream, free up resources.
-    fwrite(section_cper, sizeof(EFI_PLATFORM_MEMORY_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write to stream, free up resources.
+	fwrite(section_cper, sizeof(EFI_PLATFORM_MEMORY_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
 
 //Converts a single Memory Error 2 IR section into CPER binary, outputting to the provided stream.
-void ir_section_memory2_to_cper(json_object* section, FILE* out)
+void ir_section_memory2_to_cper(json_object *section, FILE *out)
 {
-    EFI_PLATFORM_MEMORY2_ERROR_DATA* section_cper = 
-        (EFI_PLATFORM_MEMORY2_ERROR_DATA*)calloc(1, sizeof(EFI_PLATFORM_MEMORY2_ERROR_DATA));
+	EFI_PLATFORM_MEMORY2_ERROR_DATA *section_cper =
+		(EFI_PLATFORM_MEMORY2_ERROR_DATA *)calloc(
+			1, sizeof(EFI_PLATFORM_MEMORY2_ERROR_DATA));
 
-    //Validation bits.
-    section_cper->ValidFields = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        22, MEMORY_ERROR_2_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 22,
+		MEMORY_ERROR_2_VALID_BITFIELD_NAMES);
 
-    //Error status.
-    ir_generic_error_status_to_cper(json_object_object_get(section, "errorStatus"), &section_cper->ErrorStatus);
+	//Error status.
+	ir_generic_error_status_to_cper(json_object_object_get(section,
+							       "errorStatus"),
+					&section_cper->ErrorStatus);
 
-    //Bank.
-    json_object* bank = json_object_object_get(section, "bank");
-    if ((section_cper->ValidFields >> 5) & 0x1)
-    {
-        //Bank just uses simple address.
-        section_cper->Bank = (UINT16)json_object_get_uint64(json_object_object_get(bank, "value"));
-    }
-    else
-    {
-        //Bank uses address/group style address.
-        UINT16 address = (UINT8)json_object_get_uint64(json_object_object_get(bank, "address"));
-        UINT16 group = (UINT8)json_object_get_uint64(json_object_object_get(bank, "group"));
-        section_cper->Bank = address + (group << 8);
-    }
+	//Bank.
+	json_object *bank = json_object_object_get(section, "bank");
+	if ((section_cper->ValidFields >> 5) & 0x1) {
+		//Bank just uses simple address.
+		section_cper->Bank = (UINT16)json_object_get_uint64(
+			json_object_object_get(bank, "value"));
+	} else {
+		//Bank uses address/group style address.
+		UINT16 address = (UINT8)json_object_get_uint64(
+			json_object_object_get(bank, "address"));
+		UINT16 group = (UINT8)json_object_get_uint64(
+			json_object_object_get(bank, "group"));
+		section_cper->Bank = address + (group << 8);
+	}
 
-    //Miscellaneous value fields.
-    section_cper->MemErrorType = readable_pair_to_integer(json_object_object_get(section, "memoryErrorType"));
-    section_cper->Status = (UINT8)readable_pair_to_integer(json_object_object_get(section, "status"));
-    section_cper->PhysicalAddress = json_object_get_uint64(json_object_object_get(section, "physicalAddress"));
-    section_cper->PhysicalAddressMask = json_object_get_uint64(json_object_object_get(section, "physicalAddressMask"));
-    section_cper->Node = (UINT16)json_object_get_uint64(json_object_object_get(section, "node"));
-    section_cper->Card = (UINT16)json_object_get_uint64(json_object_object_get(section, "card"));
-    section_cper->Module = (UINT32)json_object_get_uint64(json_object_object_get(section, "module"));
-    section_cper->Device = (UINT32)json_object_get_uint64(json_object_object_get(section, "device"));
-    section_cper->Row = (UINT32)json_object_get_uint64(json_object_object_get(section, "row"));
-    section_cper->Column = (UINT32)json_object_get_uint64(json_object_object_get(section, "column"));
-    section_cper->Rank = (UINT32)json_object_get_uint64(json_object_object_get(section, "rank"));
-    section_cper->BitPosition = (UINT32)json_object_get_uint64(json_object_object_get(section, "bitPosition"));
-    section_cper->ChipId = (UINT8)json_object_get_uint64(json_object_object_get(section, "chipID"));
-    section_cper->RequestorId = json_object_get_uint64(json_object_object_get(section, "requestorID"));
-    section_cper->ResponderId = json_object_get_uint64(json_object_object_get(section, "responderID"));
-    section_cper->TargetId = json_object_get_uint64(json_object_object_get(section, "targetID"));
-    section_cper->CardHandle = (UINT32)json_object_get_uint64(json_object_object_get(section, "cardSmbiosHandle"));
-    section_cper->ModuleHandle = (UINT32)json_object_get_uint64(json_object_object_get(section, "moduleSmbiosHandle"));
+	//Miscellaneous value fields.
+	section_cper->MemErrorType = readable_pair_to_integer(
+		json_object_object_get(section, "memoryErrorType"));
+	section_cper->Status = (UINT8)readable_pair_to_integer(
+		json_object_object_get(section, "status"));
+	section_cper->PhysicalAddress = json_object_get_uint64(
+		json_object_object_get(section, "physicalAddress"));
+	section_cper->PhysicalAddressMask = json_object_get_uint64(
+		json_object_object_get(section, "physicalAddressMask"));
+	section_cper->Node = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "node"));
+	section_cper->Card = (UINT16)json_object_get_uint64(
+		json_object_object_get(section, "card"));
+	section_cper->Module = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "module"));
+	section_cper->Device = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "device"));
+	section_cper->Row = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "row"));
+	section_cper->Column = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "column"));
+	section_cper->Rank = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "rank"));
+	section_cper->BitPosition = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "bitPosition"));
+	section_cper->ChipId = (UINT8)json_object_get_uint64(
+		json_object_object_get(section, "chipID"));
+	section_cper->RequestorId = json_object_get_uint64(
+		json_object_object_get(section, "requestorID"));
+	section_cper->ResponderId = json_object_get_uint64(
+		json_object_object_get(section, "responderID"));
+	section_cper->TargetId = json_object_get_uint64(
+		json_object_object_get(section, "targetID"));
+	section_cper->CardHandle = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "cardSmbiosHandle"));
+	section_cper->ModuleHandle = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "moduleSmbiosHandle"));
 
-    //Write to stream, free up resources.
-    fwrite(section_cper, sizeof(EFI_PLATFORM_MEMORY2_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write to stream, free up resources.
+	fwrite(section_cper, sizeof(EFI_PLATFORM_MEMORY2_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-pci-bus.c b/sections/cper-section-pci-bus.c
index 0065192..106af1c 100644
--- a/sections/cper-section-pci-bus.c
+++ b/sections/cper-section-pci-bus.c
@@ -12,77 +12,105 @@
 #include "cper-section-pci-bus.h"
 
 //Converts a single PCI/PCI-X bus CPER section into JSON IR.
-json_object* cper_section_pci_bus_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_pci_bus_to_ir(void *section,
+			   EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_PCI_PCIX_BUS_ERROR_DATA* bus_error = (EFI_PCI_PCIX_BUS_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_PCI_PCIX_BUS_ERROR_DATA *bus_error =
+		(EFI_PCI_PCIX_BUS_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(bus_error->ValidFields, 9, PCI_BUS_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation = bitfield_to_ir(
+		bus_error->ValidFields, 9, PCI_BUS_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Error status.
-    json_object* error_status = cper_generic_error_status_to_ir(&bus_error->ErrorStatus);
-    json_object_object_add(section_ir, "errorStatus", error_status);
+	//Error status.
+	json_object *error_status =
+		cper_generic_error_status_to_ir(&bus_error->ErrorStatus);
+	json_object_object_add(section_ir, "errorStatus", error_status);
 
-    //PCI bus error type.
-    json_object* error_type = integer_to_readable_pair(bus_error->Type, 8,
-        PCI_BUS_ERROR_TYPES_KEYS,
-        PCI_BUS_ERROR_TYPES_VALUES,
-        "Unknown (Reserved)");
-    json_object_object_add(section_ir, "errorType", error_type);
+	//PCI bus error type.
+	json_object *error_type = integer_to_readable_pair(
+		bus_error->Type, 8, PCI_BUS_ERROR_TYPES_KEYS,
+		PCI_BUS_ERROR_TYPES_VALUES, "Unknown (Reserved)");
+	json_object_object_add(section_ir, "errorType", error_type);
 
-    //Bus ID.
-    json_object* bus_id = json_object_new_object();
-    json_object_object_add(bus_id, "busNumber", json_object_new_int(bus_error->BusId & 0xFF));
-    json_object_object_add(bus_id, "segmentNumber", json_object_new_int(bus_error->BusId >> 8));
-    json_object_object_add(section_ir, "busID", bus_id);
+	//Bus ID.
+	json_object *bus_id = json_object_new_object();
+	json_object_object_add(bus_id, "busNumber",
+			       json_object_new_int(bus_error->BusId & 0xFF));
+	json_object_object_add(bus_id, "segmentNumber",
+			       json_object_new_int(bus_error->BusId >> 8));
+	json_object_object_add(section_ir, "busID", bus_id);
 
-    //Miscellaneous numeric fields.
-    UINT8 command_type = (bus_error->BusCommand >> 56) & 0b1; //Byte 7, bit 0.
-    json_object_object_add(section_ir, "busAddress", json_object_new_uint64(bus_error->BusAddress));
-    json_object_object_add(section_ir, "busData", json_object_new_uint64(bus_error->BusData));
-    json_object_object_add(section_ir, "busCommandType", json_object_new_string(command_type == 0 ? "PCI" : "PCI-X"));
-    json_object_object_add(section_ir, "busRequestorID", json_object_new_uint64(bus_error->RequestorId));
-    json_object_object_add(section_ir, "busCompleterID", json_object_new_uint64(bus_error->ResponderId));
-    json_object_object_add(section_ir, "targetID", json_object_new_uint64(bus_error->TargetId));
+	//Miscellaneous numeric fields.
+	UINT8 command_type = (bus_error->BusCommand >> 56) &
+			     0b1; //Byte 7, bit 0.
+	json_object_object_add(section_ir, "busAddress",
+			       json_object_new_uint64(bus_error->BusAddress));
+	json_object_object_add(section_ir, "busData",
+			       json_object_new_uint64(bus_error->BusData));
+	json_object_object_add(
+		section_ir, "busCommandType",
+		json_object_new_string(command_type == 0 ? "PCI" : "PCI-X"));
+	json_object_object_add(section_ir, "busRequestorID",
+			       json_object_new_uint64(bus_error->RequestorId));
+	json_object_object_add(section_ir, "busCompleterID",
+			       json_object_new_uint64(bus_error->ResponderId));
+	json_object_object_add(section_ir, "targetID",
+			       json_object_new_uint64(bus_error->TargetId));
 
-    return section_ir;
+	return section_ir;
 }
 
 //Converts a single provided PCI/PCI-X bus CPER-JSON section into CPER binary, outputting to the
 //provided stream.
-void ir_section_pci_bus_to_cper(json_object* section, FILE* out)
+void ir_section_pci_bus_to_cper(json_object *section, FILE *out)
 {
-    EFI_PCI_PCIX_BUS_ERROR_DATA* section_cper =
-        (EFI_PCI_PCIX_BUS_ERROR_DATA*)calloc(1, sizeof(EFI_PCI_PCIX_BUS_ERROR_DATA));
+	EFI_PCI_PCIX_BUS_ERROR_DATA *section_cper =
+		(EFI_PCI_PCIX_BUS_ERROR_DATA *)calloc(
+			1, sizeof(EFI_PCI_PCIX_BUS_ERROR_DATA));
 
-    //Validation bits.
-    section_cper->ValidFields = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        9, PCI_BUS_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 9,
+		PCI_BUS_ERROR_VALID_BITFIELD_NAMES);
 
-    //Error status.
-    ir_generic_error_status_to_cper(json_object_object_get(section, "errorStatus"), &section_cper->ErrorStatus);
+	//Error status.
+	ir_generic_error_status_to_cper(json_object_object_get(section,
+							       "errorStatus"),
+					&section_cper->ErrorStatus);
 
-    //Bus ID.
-    json_object* bus_id = json_object_object_get(section, "busID");
-    UINT16 bus_number = (UINT8)json_object_get_int(json_object_object_get(bus_id, "busNumber"));
-    UINT16 segment_number = (UINT8)json_object_get_int(json_object_object_get(bus_id, "segmentNumber"));
-    section_cper->BusId = bus_number + (segment_number << 8);
+	//Bus ID.
+	json_object *bus_id = json_object_object_get(section, "busID");
+	UINT16 bus_number = (UINT8)json_object_get_int(
+		json_object_object_get(bus_id, "busNumber"));
+	UINT16 segment_number = (UINT8)json_object_get_int(
+		json_object_object_get(bus_id, "segmentNumber"));
+	section_cper->BusId = bus_number + (segment_number << 8);
 
-    //Remaining fields.
-    UINT64 pcix_command = (UINT64)0x1 << 56;
-    const char* bus_command = json_object_get_string(json_object_object_get(section, "busCommandType"));
-    section_cper->Type = (UINT16)readable_pair_to_integer(json_object_object_get(section, "errorType"));
-    section_cper->BusAddress = json_object_get_uint64(json_object_object_get(section, "busAddress"));
-    section_cper->BusData = json_object_get_uint64(json_object_object_get(section, "busData"));
-    section_cper->BusCommand = strcmp(bus_command, "PCI") == 0 ? 0 : pcix_command;
-    section_cper->RequestorId = json_object_get_uint64(json_object_object_get(section, "busRequestorID"));
-    section_cper->ResponderId = json_object_get_uint64(json_object_object_get(section, "busCompleterID"));
-    section_cper->TargetId = json_object_get_uint64(json_object_object_get(section, "targetID"));
+	//Remaining fields.
+	UINT64 pcix_command = (UINT64)0x1 << 56;
+	const char *bus_command = json_object_get_string(
+		json_object_object_get(section, "busCommandType"));
+	section_cper->Type = (UINT16)readable_pair_to_integer(
+		json_object_object_get(section, "errorType"));
+	section_cper->BusAddress = json_object_get_uint64(
+		json_object_object_get(section, "busAddress"));
+	section_cper->BusData = json_object_get_uint64(
+		json_object_object_get(section, "busData"));
+	section_cper->BusCommand =
+		strcmp(bus_command, "PCI") == 0 ? 0 : pcix_command;
+	section_cper->RequestorId = json_object_get_uint64(
+		json_object_object_get(section, "busRequestorID"));
+	section_cper->ResponderId = json_object_get_uint64(
+		json_object_object_get(section, "busCompleterID"));
+	section_cper->TargetId = json_object_get_uint64(
+		json_object_object_get(section, "targetID"));
 
-    //Write to stream, free resources.
-    fwrite(section_cper, sizeof(EFI_PCI_PCIX_BUS_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write to stream, free resources.
+	fwrite(section_cper, sizeof(EFI_PCI_PCIX_BUS_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file
diff --git a/sections/cper-section-pci-dev.c b/sections/cper-section-pci-dev.c
index cae0c2b..55b547b 100644
--- a/sections/cper-section-pci-dev.c
+++ b/sections/cper-section-pci-dev.c
@@ -11,102 +11,142 @@
 #include "cper-section-pci-dev.h"
 
 //Converts a single PCI/PCI-X device CPER section into JSON IR.
-json_object* cper_section_pci_dev_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *
+cper_section_pci_dev_to_ir(void *section,
+			   EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_PCI_PCIX_DEVICE_ERROR_DATA* dev_error = (EFI_PCI_PCIX_DEVICE_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_PCI_PCIX_DEVICE_ERROR_DATA *dev_error =
+		(EFI_PCI_PCIX_DEVICE_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(dev_error->ValidFields, 5, PCI_DEV_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation = bitfield_to_ir(
+		dev_error->ValidFields, 5, PCI_DEV_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Error status.
-    json_object* error_status = cper_generic_error_status_to_ir(&dev_error->ErrorStatus);
-    json_object_object_add(section_ir, "errorStatus", error_status);
+	//Error status.
+	json_object *error_status =
+		cper_generic_error_status_to_ir(&dev_error->ErrorStatus);
+	json_object_object_add(section_ir, "errorStatus", error_status);
 
-    //ID information.
-    json_object* id_info = json_object_new_object();
-    json_object_object_add(id_info, "vendorID", json_object_new_uint64(dev_error->IdInfo.VendorId));
-    json_object_object_add(id_info, "deviceID", json_object_new_uint64(dev_error->IdInfo.DeviceId));
-    json_object_object_add(id_info, "classCode", json_object_new_uint64(dev_error->IdInfo.ClassCode));
-    json_object_object_add(id_info, "functionNumber", json_object_new_uint64(dev_error->IdInfo.FunctionNumber));
-    json_object_object_add(id_info, "deviceNumber", json_object_new_uint64(dev_error->IdInfo.DeviceNumber));
-    json_object_object_add(id_info, "busNumber", json_object_new_uint64(dev_error->IdInfo.BusNumber));
-    json_object_object_add(id_info, "segmentNumber", json_object_new_uint64(dev_error->IdInfo.SegmentNumber));
-    json_object_object_add(section_ir, "idInfo", id_info);
+	//ID information.
+	json_object *id_info = json_object_new_object();
+	json_object_object_add(
+		id_info, "vendorID",
+		json_object_new_uint64(dev_error->IdInfo.VendorId));
+	json_object_object_add(
+		id_info, "deviceID",
+		json_object_new_uint64(dev_error->IdInfo.DeviceId));
+	json_object_object_add(
+		id_info, "classCode",
+		json_object_new_uint64(dev_error->IdInfo.ClassCode));
+	json_object_object_add(
+		id_info, "functionNumber",
+		json_object_new_uint64(dev_error->IdInfo.FunctionNumber));
+	json_object_object_add(
+		id_info, "deviceNumber",
+		json_object_new_uint64(dev_error->IdInfo.DeviceNumber));
+	json_object_object_add(
+		id_info, "busNumber",
+		json_object_new_uint64(dev_error->IdInfo.BusNumber));
+	json_object_object_add(
+		id_info, "segmentNumber",
+		json_object_new_uint64(dev_error->IdInfo.SegmentNumber));
+	json_object_object_add(section_ir, "idInfo", id_info);
 
-    //Number of following register data pairs.
-    json_object_object_add(section_ir, "memoryNumber", json_object_new_uint64(dev_error->MemoryNumber));
-    json_object_object_add(section_ir, "ioNumber", json_object_new_uint64(dev_error->IoNumber));
-    int num_data_pairs = dev_error->MemoryNumber + dev_error->IoNumber;
+	//Number of following register data pairs.
+	json_object_object_add(section_ir, "memoryNumber",
+			       json_object_new_uint64(dev_error->MemoryNumber));
+	json_object_object_add(section_ir, "ioNumber",
+			       json_object_new_uint64(dev_error->IoNumber));
+	int num_data_pairs = dev_error->MemoryNumber + dev_error->IoNumber;
 
-    //Register pairs, described by the numeric fields.
-    //The actual "pairs" of address and data aren't necessarily 8 bytes long, so can't assume the contents.
-    //Hence the naming "firstHalf" and "secondHalf" rather than "address" and "data".
-    json_object* register_data_pair_array = json_object_new_array();
-    UINT64* cur_pos = (UINT64*)(dev_error + 1);
-    for (int i=0; i<num_data_pairs; i++)
-    {
-        //Save current pair to array.
-        json_object* register_data_pair = json_object_new_object();
-        json_object_object_add(register_data_pair, "firstHalf", json_object_new_uint64(*cur_pos));
-        json_object_object_add(register_data_pair, "secondHalf", json_object_new_uint64(*(cur_pos + 1)));
-        json_object_array_add(register_data_pair_array, register_data_pair);
+	//Register pairs, described by the numeric fields.
+	//The actual "pairs" of address and data aren't necessarily 8 bytes long, so can't assume the contents.
+	//Hence the naming "firstHalf" and "secondHalf" rather than "address" and "data".
+	json_object *register_data_pair_array = json_object_new_array();
+	UINT64 *cur_pos = (UINT64 *)(dev_error + 1);
+	for (int i = 0; i < num_data_pairs; i++) {
+		//Save current pair to array.
+		json_object *register_data_pair = json_object_new_object();
+		json_object_object_add(register_data_pair, "firstHalf",
+				       json_object_new_uint64(*cur_pos));
+		json_object_object_add(register_data_pair, "secondHalf",
+				       json_object_new_uint64(*(cur_pos + 1)));
+		json_object_array_add(register_data_pair_array,
+				      register_data_pair);
 
-        //Move to next pair.
-        cur_pos += 2;
-    }
-    json_object_object_add(section_ir, "registerDataPairs", register_data_pair_array);
+		//Move to next pair.
+		cur_pos += 2;
+	}
+	json_object_object_add(section_ir, "registerDataPairs",
+			       register_data_pair_array);
 
-    return section_ir;
+	return section_ir;
 }
 
-void ir_section_pci_dev_to_cper(json_object* section, FILE* out)
+void ir_section_pci_dev_to_cper(json_object *section, FILE *out)
 {
-    EFI_PCI_PCIX_DEVICE_ERROR_DATA* section_cper =
-        (EFI_PCI_PCIX_DEVICE_ERROR_DATA*)calloc(1, sizeof(EFI_PCI_PCIX_DEVICE_ERROR_DATA));
+	EFI_PCI_PCIX_DEVICE_ERROR_DATA *section_cper =
+		(EFI_PCI_PCIX_DEVICE_ERROR_DATA *)calloc(
+			1, sizeof(EFI_PCI_PCIX_DEVICE_ERROR_DATA));
 
-    //Validation bits.
-    section_cper->ValidFields = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        5, PCI_DEV_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 5,
+		PCI_DEV_ERROR_VALID_BITFIELD_NAMES);
 
-    //Error status.
-    ir_generic_error_status_to_cper(json_object_object_get(section, "errorStatus"), &section_cper->ErrorStatus);
+	//Error status.
+	ir_generic_error_status_to_cper(json_object_object_get(section,
+							       "errorStatus"),
+					&section_cper->ErrorStatus);
 
-    //Device ID information.
-    json_object* id_info = json_object_object_get(section, "idInfo");
-    section_cper->IdInfo.VendorId = json_object_get_uint64(json_object_object_get(id_info, "vendorID"));
-    section_cper->IdInfo.DeviceId = json_object_get_uint64(json_object_object_get(id_info, "deviceID"));
-    section_cper->IdInfo.ClassCode = json_object_get_uint64(json_object_object_get(id_info, "classCode"));
-    section_cper->IdInfo.FunctionNumber = json_object_get_uint64(json_object_object_get(id_info, "functionNumber"));
-    section_cper->IdInfo.DeviceNumber = json_object_get_uint64(json_object_object_get(id_info, "deviceNumber"));
-    section_cper->IdInfo.BusNumber = json_object_get_uint64(json_object_object_get(id_info, "busNumber"));
-    section_cper->IdInfo.SegmentNumber = json_object_get_uint64(json_object_object_get(id_info, "segmentNumber"));
+	//Device ID information.
+	json_object *id_info = json_object_object_get(section, "idInfo");
+	section_cper->IdInfo.VendorId = json_object_get_uint64(
+		json_object_object_get(id_info, "vendorID"));
+	section_cper->IdInfo.DeviceId = json_object_get_uint64(
+		json_object_object_get(id_info, "deviceID"));
+	section_cper->IdInfo.ClassCode = json_object_get_uint64(
+		json_object_object_get(id_info, "classCode"));
+	section_cper->IdInfo.FunctionNumber = json_object_get_uint64(
+		json_object_object_get(id_info, "functionNumber"));
+	section_cper->IdInfo.DeviceNumber = json_object_get_uint64(
+		json_object_object_get(id_info, "deviceNumber"));
+	section_cper->IdInfo.BusNumber = json_object_get_uint64(
+		json_object_object_get(id_info, "busNumber"));
+	section_cper->IdInfo.SegmentNumber = json_object_get_uint64(
+		json_object_object_get(id_info, "segmentNumber"));
 
-    //Amount of following data pairs.
-    section_cper->MemoryNumber = (UINT32)json_object_get_uint64(json_object_object_get(section, "memoryNumber"));
-    section_cper->IoNumber = (UINT32)json_object_get_uint64(json_object_object_get(section, "ioNumber"));
+	//Amount of following data pairs.
+	section_cper->MemoryNumber = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "memoryNumber"));
+	section_cper->IoNumber = (UINT32)json_object_get_uint64(
+		json_object_object_get(section, "ioNumber"));
 
-    //Write header out to stream, free it.
-    fwrite(section_cper, sizeof(EFI_PCI_PCIX_DEVICE_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write header out to stream, free it.
+	fwrite(section_cper, sizeof(EFI_PCI_PCIX_DEVICE_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 
-    //Begin writing register pairs.
-    json_object* register_pairs = json_object_object_get(section, "registerDataPairs");
-    int num_pairs = json_object_array_length(register_pairs);
-    for (int i=0; i<num_pairs; i++)
-    {
-        //Get the pair array item out.
-        json_object* register_pair = json_object_array_get_idx(register_pairs, i);
+	//Begin writing register pairs.
+	json_object *register_pairs =
+		json_object_object_get(section, "registerDataPairs");
+	int num_pairs = json_object_array_length(register_pairs);
+	for (int i = 0; i < num_pairs; i++) {
+		//Get the pair array item out.
+		json_object *register_pair =
+			json_object_array_get_idx(register_pairs, i);
 
-        //Create the pair array.
-        UINT64 pair[2];
-        pair[0] = json_object_get_uint64(json_object_object_get(register_pair, "firstHalf"));
-        pair[1] = json_object_get_uint64(json_object_object_get(register_pair, "secondHalf"));
+		//Create the pair array.
+		UINT64 pair[2];
+		pair[0] = json_object_get_uint64(
+			json_object_object_get(register_pair, "firstHalf"));
+		pair[1] = json_object_get_uint64(
+			json_object_object_get(register_pair, "secondHalf"));
 
-        //Push to stream.
-        fwrite(pair, sizeof(UINT64), 2, out);
-        fflush(out);
-    }
+		//Push to stream.
+		fwrite(pair, sizeof(UINT64), 2, out);
+		fflush(out);
+	}
 }
\ No newline at end of file
diff --git a/sections/cper-section-pcie.c b/sections/cper-section-pcie.c
index d5a7729..5b49fa2 100644
--- a/sections/cper-section-pcie.c
+++ b/sections/cper-section-pcie.c
@@ -13,150 +13,204 @@
 #include "cper-section-pcie.h"
 
 //Converts a single PCIe CPER section into JSON IR.
-json_object* cper_section_pcie_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
+json_object *cper_section_pcie_to_ir(void *section,
+				     EFI_ERROR_SECTION_DESCRIPTOR *descriptor)
 {
-    EFI_PCIE_ERROR_DATA* pcie_error = (EFI_PCIE_ERROR_DATA*)section;
-    json_object* section_ir = json_object_new_object();
+	EFI_PCIE_ERROR_DATA *pcie_error = (EFI_PCIE_ERROR_DATA *)section;
+	json_object *section_ir = json_object_new_object();
 
-    //Validation bits.
-    json_object* validation = bitfield_to_ir(pcie_error->ValidFields, 8, PCIE_ERROR_VALID_BITFIELD_NAMES);
-    json_object_object_add(section_ir, "validationBits", validation);
+	//Validation bits.
+	json_object *validation = bitfield_to_ir(
+		pcie_error->ValidFields, 8, PCIE_ERROR_VALID_BITFIELD_NAMES);
+	json_object_object_add(section_ir, "validationBits", validation);
 
-    //Port type.
-    json_object* port_type = integer_to_readable_pair(pcie_error->PortType, 9,
-        PCIE_ERROR_PORT_TYPES_KEYS,
-        PCIE_ERROR_PORT_TYPES_VALUES,
-        "Unknown");
-    json_object_object_add(section_ir, "portType", port_type);
+	//Port type.
+	json_object *port_type = integer_to_readable_pair(
+		pcie_error->PortType, 9, PCIE_ERROR_PORT_TYPES_KEYS,
+		PCIE_ERROR_PORT_TYPES_VALUES, "Unknown");
+	json_object_object_add(section_ir, "portType", port_type);
 
-    //Version, provided each half in BCD.
-    json_object* version = json_object_new_object();
-    json_object_object_add(version, "minor", json_object_new_int(bcd_to_int(pcie_error->Version & 0xFF)));
-    json_object_object_add(version, "major", json_object_new_int(bcd_to_int(pcie_error->Version >> 8)));
-    json_object_object_add(section_ir, "version", version);
+	//Version, provided each half in BCD.
+	json_object *version = json_object_new_object();
+	json_object_object_add(
+		version, "minor",
+		json_object_new_int(bcd_to_int(pcie_error->Version & 0xFF)));
+	json_object_object_add(
+		version, "major",
+		json_object_new_int(bcd_to_int(pcie_error->Version >> 8)));
+	json_object_object_add(section_ir, "version", version);
 
-    //Command & status.
-    json_object* command_status = json_object_new_object();
-    json_object_object_add(command_status, "commandRegister", json_object_new_uint64(pcie_error->CommandStatus & 0xFFFF));
-    json_object_object_add(command_status, "statusRegister", json_object_new_uint64(pcie_error->CommandStatus >> 16));
-    json_object_object_add(section_ir, "commandStatus", command_status);
+	//Command & status.
+	json_object *command_status = json_object_new_object();
+	json_object_object_add(
+		command_status, "commandRegister",
+		json_object_new_uint64(pcie_error->CommandStatus & 0xFFFF));
+	json_object_object_add(
+		command_status, "statusRegister",
+		json_object_new_uint64(pcie_error->CommandStatus >> 16));
+	json_object_object_add(section_ir, "commandStatus", command_status);
 
-    //PCIe Device ID.
-    json_object* device_id = json_object_new_object();
-    UINT64 class_id = (pcie_error->DevBridge.ClassCode[0] << 16) + 
-                      (pcie_error->DevBridge.ClassCode[1] << 8) +
-                      pcie_error->DevBridge.ClassCode[2];
-    json_object_object_add(device_id, "vendorID", json_object_new_uint64(pcie_error->DevBridge.VendorId));
-    json_object_object_add(device_id, "deviceID", json_object_new_uint64(pcie_error->DevBridge.DeviceId));
-    json_object_object_add(device_id, "classCode", json_object_new_uint64(class_id));
-    json_object_object_add(device_id, "functionNumber", json_object_new_uint64(pcie_error->DevBridge.Function));
-    json_object_object_add(device_id, "deviceNumber", json_object_new_uint64(pcie_error->DevBridge.Device));
-    json_object_object_add(device_id, "segmentNumber", json_object_new_uint64(pcie_error->DevBridge.Segment));
-    json_object_object_add(device_id, "primaryOrDeviceBusNumber", json_object_new_uint64(pcie_error->DevBridge.PrimaryOrDeviceBus));
-    json_object_object_add(device_id, "secondaryBusNumber", json_object_new_uint64(pcie_error->DevBridge.SecondaryBus));
-    json_object_object_add(device_id, "slotNumber", json_object_new_uint64(pcie_error->DevBridge.Slot.Number));
-    json_object_object_add(section_ir, "deviceID", device_id);
+	//PCIe Device ID.
+	json_object *device_id = json_object_new_object();
+	UINT64 class_id = (pcie_error->DevBridge.ClassCode[0] << 16) +
+			  (pcie_error->DevBridge.ClassCode[1] << 8) +
+			  pcie_error->DevBridge.ClassCode[2];
+	json_object_object_add(
+		device_id, "vendorID",
+		json_object_new_uint64(pcie_error->DevBridge.VendorId));
+	json_object_object_add(
+		device_id, "deviceID",
+		json_object_new_uint64(pcie_error->DevBridge.DeviceId));
+	json_object_object_add(device_id, "classCode",
+			       json_object_new_uint64(class_id));
+	json_object_object_add(
+		device_id, "functionNumber",
+		json_object_new_uint64(pcie_error->DevBridge.Function));
+	json_object_object_add(
+		device_id, "deviceNumber",
+		json_object_new_uint64(pcie_error->DevBridge.Device));
+	json_object_object_add(
+		device_id, "segmentNumber",
+		json_object_new_uint64(pcie_error->DevBridge.Segment));
+	json_object_object_add(
+		device_id, "primaryOrDeviceBusNumber",
+		json_object_new_uint64(
+			pcie_error->DevBridge.PrimaryOrDeviceBus));
+	json_object_object_add(
+		device_id, "secondaryBusNumber",
+		json_object_new_uint64(pcie_error->DevBridge.SecondaryBus));
+	json_object_object_add(
+		device_id, "slotNumber",
+		json_object_new_uint64(pcie_error->DevBridge.Slot.Number));
+	json_object_object_add(section_ir, "deviceID", device_id);
 
-    //Device serial number.
-    json_object_object_add(section_ir, "deviceSerialNumber", json_object_new_uint64(pcie_error->SerialNo));
+	//Device serial number.
+	json_object_object_add(section_ir, "deviceSerialNumber",
+			       json_object_new_uint64(pcie_error->SerialNo));
 
-    //Bridge control status.
-    json_object* bridge_control_status = json_object_new_object();
-    json_object_object_add(bridge_control_status, "secondaryStatusRegister", 
-        json_object_new_uint64(pcie_error->BridgeControlStatus & 0xFFFF));
-    json_object_object_add(bridge_control_status, "controlRegister", 
-        json_object_new_uint64(pcie_error->BridgeControlStatus >> 16));
-    json_object_object_add(section_ir, "bridgeControlStatus", bridge_control_status);
+	//Bridge control status.
+	json_object *bridge_control_status = json_object_new_object();
+	json_object_object_add(
+		bridge_control_status, "secondaryStatusRegister",
+		json_object_new_uint64(pcie_error->BridgeControlStatus &
+				       0xFFFF));
+	json_object_object_add(
+		bridge_control_status, "controlRegister",
+		json_object_new_uint64(pcie_error->BridgeControlStatus >> 16));
+	json_object_object_add(section_ir, "bridgeControlStatus",
+			       bridge_control_status);
 
-    //Capability structure.
-    //The PCIe capability structure provided here could either be PCIe 1.1 Capability Structure 
-    //(36-byte, padded to 60 bytes) or PCIe 2.0 Capability Structure (60-byte). There does not seem
-    //to be a way to differentiate these, so this is left as a b64 dump.
-    char* encoded = b64_encode((unsigned char*)pcie_error->Capability.PcieCap, 60);
-    json_object* capability = json_object_new_object();
-    json_object_object_add(capability, "data", json_object_new_string(encoded));
-    free(encoded);
-    json_object_object_add(section_ir, "capabilityStructure", capability);
+	//Capability structure.
+	//The PCIe capability structure provided here could either be PCIe 1.1 Capability Structure
+	//(36-byte, padded to 60 bytes) or PCIe 2.0 Capability Structure (60-byte). There does not seem
+	//to be a way to differentiate these, so this is left as a b64 dump.
+	char *encoded =
+		b64_encode((unsigned char *)pcie_error->Capability.PcieCap, 60);
+	json_object *capability = json_object_new_object();
+	json_object_object_add(capability, "data",
+			       json_object_new_string(encoded));
+	free(encoded);
+	json_object_object_add(section_ir, "capabilityStructure", capability);
 
-    //AER information.
-    json_object* aer_capability_ir = json_object_new_object();
-    encoded = b64_encode((unsigned char*)pcie_error->AerInfo.PcieAer, 96);
-    json_object_object_add(aer_capability_ir, "data", json_object_new_string(encoded));
-    free(encoded);
-    json_object_object_add(section_ir, "aerInfo", aer_capability_ir);
-    return section_ir;
+	//AER information.
+	json_object *aer_capability_ir = json_object_new_object();
+	encoded = b64_encode((unsigned char *)pcie_error->AerInfo.PcieAer, 96);
+	json_object_object_add(aer_capability_ir, "data",
+			       json_object_new_string(encoded));
+	free(encoded);
+	json_object_object_add(section_ir, "aerInfo", aer_capability_ir);
+	return section_ir;
 }
 
 //Converts a single CPER-JSON PCIe section into CPER binary, outputting to the given stream.
-void ir_section_pcie_to_cper(json_object* section, FILE* out)
+void ir_section_pcie_to_cper(json_object *section, FILE *out)
 {
-    EFI_PCIE_ERROR_DATA* section_cper = (EFI_PCIE_ERROR_DATA*)calloc(1, sizeof(EFI_PCIE_ERROR_DATA));
+	EFI_PCIE_ERROR_DATA *section_cper =
+		(EFI_PCIE_ERROR_DATA *)calloc(1, sizeof(EFI_PCIE_ERROR_DATA));
 
-    //Validation bits.
-    section_cper->ValidFields = ir_to_bitfield(json_object_object_get(section, "validationBits"), 
-        8, PCIE_ERROR_VALID_BITFIELD_NAMES);
+	//Validation bits.
+	section_cper->ValidFields = ir_to_bitfield(
+		json_object_object_get(section, "validationBits"), 8,
+		PCIE_ERROR_VALID_BITFIELD_NAMES);
 
-    //Version.
-    json_object* version = json_object_object_get(section, "version");
-    UINT32 minor = int_to_bcd(json_object_get_int(json_object_object_get(version, "minor")));
-    UINT32 major = int_to_bcd(json_object_get_int(json_object_object_get(version, "major")));
-    section_cper->Version = minor + (major << 8);
+	//Version.
+	json_object *version = json_object_object_get(section, "version");
+	UINT32 minor = int_to_bcd(
+		json_object_get_int(json_object_object_get(version, "minor")));
+	UINT32 major = int_to_bcd(
+		json_object_get_int(json_object_object_get(version, "major")));
+	section_cper->Version = minor + (major << 8);
 
-    //Command/status registers.
-    json_object* command_status = json_object_object_get(section, "commandStatus");
-    UINT32 command = (UINT16)json_object_get_uint64(json_object_object_get(command_status, "commandRegister"));
-    UINT32 status = (UINT16)json_object_get_uint64(json_object_object_get(command_status, "statusRegister"));
-    section_cper->CommandStatus = command + (status << 16);
+	//Command/status registers.
+	json_object *command_status =
+		json_object_object_get(section, "commandStatus");
+	UINT32 command = (UINT16)json_object_get_uint64(
+		json_object_object_get(command_status, "commandRegister"));
+	UINT32 status = (UINT16)json_object_get_uint64(
+		json_object_object_get(command_status, "statusRegister"));
+	section_cper->CommandStatus = command + (status << 16);
 
-    //Device ID.
-    json_object* device_id = json_object_object_get(section, "deviceID");
-    UINT64 class_id = json_object_get_uint64(json_object_object_get(device_id, "classCode"));
-    section_cper->DevBridge.VendorId = 
-        (UINT16)json_object_get_uint64(json_object_object_get(device_id, "vendorID"));
-    section_cper->DevBridge.DeviceId = 
-        (UINT16)json_object_get_uint64(json_object_object_get(device_id, "deviceID"));
-    section_cper->DevBridge.ClassCode[0] = class_id >> 16;
-    section_cper->DevBridge.ClassCode[1] = (class_id >> 8) & 0xFF;
-    section_cper->DevBridge.ClassCode[2] = class_id & 0xFF;
-    section_cper->DevBridge.Function = 
-        (UINT8)json_object_get_uint64(json_object_object_get(device_id, "functionNumber"));
-    section_cper->DevBridge.Device = 
-        (UINT8)json_object_get_uint64(json_object_object_get(device_id, "deviceNumber"));
-    section_cper->DevBridge.Segment = 
-        (UINT16)json_object_get_uint64(json_object_object_get(device_id, "segmentNumber"));
-    section_cper->DevBridge.PrimaryOrDeviceBus = 
-        (UINT8)json_object_get_uint64(json_object_object_get(device_id, "primaryOrDeviceBusNumber"));
-    section_cper->DevBridge.SecondaryBus = 
-        (UINT8)json_object_get_uint64(json_object_object_get(device_id, "secondaryBusNumber"));
-    section_cper->DevBridge.Slot.Number = 
-        (UINT16)json_object_get_uint64(json_object_object_get(device_id, "slotNumber"));
+	//Device ID.
+	json_object *device_id = json_object_object_get(section, "deviceID");
+	UINT64 class_id = json_object_get_uint64(
+		json_object_object_get(device_id, "classCode"));
+	section_cper->DevBridge.VendorId = (UINT16)json_object_get_uint64(
+		json_object_object_get(device_id, "vendorID"));
+	section_cper->DevBridge.DeviceId = (UINT16)json_object_get_uint64(
+		json_object_object_get(device_id, "deviceID"));
+	section_cper->DevBridge.ClassCode[0] = class_id >> 16;
+	section_cper->DevBridge.ClassCode[1] = (class_id >> 8) & 0xFF;
+	section_cper->DevBridge.ClassCode[2] = class_id & 0xFF;
+	section_cper->DevBridge.Function = (UINT8)json_object_get_uint64(
+		json_object_object_get(device_id, "functionNumber"));
+	section_cper->DevBridge.Device = (UINT8)json_object_get_uint64(
+		json_object_object_get(device_id, "deviceNumber"));
+	section_cper->DevBridge.Segment = (UINT16)json_object_get_uint64(
+		json_object_object_get(device_id, "segmentNumber"));
+	section_cper->DevBridge.PrimaryOrDeviceBus =
+		(UINT8)json_object_get_uint64(json_object_object_get(
+			device_id, "primaryOrDeviceBusNumber"));
+	section_cper->DevBridge.SecondaryBus = (UINT8)json_object_get_uint64(
+		json_object_object_get(device_id, "secondaryBusNumber"));
+	section_cper->DevBridge.Slot.Number = (UINT16)json_object_get_uint64(
+		json_object_object_get(device_id, "slotNumber"));
 
-    //Bridge/control status.
-    json_object* bridge_control = json_object_object_get(section, "bridgeControlStatus");
-    UINT32 bridge_status = (UINT16)json_object_get_uint64(json_object_object_get(bridge_control, "secondaryStatusRegister"));
-    UINT32 control_status = (UINT16)json_object_get_uint64(json_object_object_get(bridge_control, "controlRegister"));
-    section_cper->BridgeControlStatus = bridge_status + (control_status << 16);
+	//Bridge/control status.
+	json_object *bridge_control =
+		json_object_object_get(section, "bridgeControlStatus");
+	UINT32 bridge_status = (UINT16)json_object_get_uint64(
+		json_object_object_get(bridge_control,
+				       "secondaryStatusRegister"));
+	UINT32 control_status = (UINT16)json_object_get_uint64(
+		json_object_object_get(bridge_control, "controlRegister"));
+	section_cper->BridgeControlStatus =
+		bridge_status + (control_status << 16);
 
-    //Capability structure.
-    json_object* capability = json_object_object_get(section, "capabilityStructure");
-    json_object* encoded = json_object_object_get(capability, "data");
-    UINT8* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    memcpy(section_cper->Capability.PcieCap, decoded, 60);
-    free(decoded);
+	//Capability structure.
+	json_object *capability =
+		json_object_object_get(section, "capabilityStructure");
+	json_object *encoded = json_object_object_get(capability, "data");
+	UINT8 *decoded = b64_decode(json_object_get_string(encoded),
+				    json_object_get_string_len(encoded));
+	memcpy(section_cper->Capability.PcieCap, decoded, 60);
+	free(decoded);
 
-    //AER capability structure.
-    json_object* aer_info = json_object_object_get(section, "aerInfo");
-    encoded = json_object_object_get(aer_info, "data");
-    decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
-    memcpy(section_cper->AerInfo.PcieAer, decoded, 96);
-    free(decoded);
+	//AER capability structure.
+	json_object *aer_info = json_object_object_get(section, "aerInfo");
+	encoded = json_object_object_get(aer_info, "data");
+	decoded = b64_decode(json_object_get_string(encoded),
+			     json_object_get_string_len(encoded));
+	memcpy(section_cper->AerInfo.PcieAer, decoded, 96);
+	free(decoded);
 
-    //Miscellaneous value fields.
-    section_cper->PortType = (UINT32)readable_pair_to_integer(json_object_object_get(section, "portType"));
-    section_cper->SerialNo = json_object_get_uint64(json_object_object_get(section, "deviceSerialNumber"));
+	//Miscellaneous value fields.
+	section_cper->PortType = (UINT32)readable_pair_to_integer(
+		json_object_object_get(section, "portType"));
+	section_cper->SerialNo = json_object_get_uint64(
+		json_object_object_get(section, "deviceSerialNumber"));
 
-    //Write out to stream, free resources.
-    fwrite(section_cper, sizeof(EFI_PCIE_ERROR_DATA), 1, out);
-    fflush(out);
-    free(section_cper);
+	//Write out to stream, free resources.
+	fwrite(section_cper, sizeof(EFI_PCIE_ERROR_DATA), 1, out);
+	fflush(out);
+	free(section_cper);
 }
\ No newline at end of file