diff --git a/init/init_RM6785.cpp b/init/init_RM6785.cpp
index b691fed..2ce8964 100644
--- a/init/init_RM6785.cpp
+++ b/init/init_RM6785.cpp
@@ -1,135 +1,132 @@
 //
-// Copyright (C) 2022 The LineageOS Project
+// Copyright (C) 2022-2023 The LineageOS Project
 //
 // SPDX-License-Identifier: Apache-2.0
 //
 
-#include <fstream>
-#include <tuple>
+#include <android-base/file.h>
 #include <android-base/logging.h>
+#include <vector>
 
 #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
 #include <sys/_system_properties.h>
 
 #include "vendor_init.h"
 
-#define PROC_OPERATOR "/proc/oppoVersion/operatorName"
+constexpr const char* kProcOperatorPath = "/proc/oppoVersion/operatorName";
 
-void property_override(std::string prop, std::string value, bool add = true) {
-    auto pi = (prop_info *)__system_property_find(prop.c_str());
+struct DeviceProps {
+    std::string device;
+    std::string model;
+};
+
+void property_override(const char* prop, const char* value, bool add = true) {
+    prop_info* pi = (prop_info*)__system_property_find(prop);
 
     if (pi != nullptr) {
-        __system_property_update(pi, value.c_str(), value.size());
+        __system_property_update(pi, value, strlen(value));
     } else if (add) {
-        __system_property_add(prop.c_str(), prop.size(), value.c_str(),
-                              value.size());
+        __system_property_add(prop, strlen(prop), value, strlen(value));
     }
 }
 
-void set_ro_build_prop(const std::string &prop, const std::string &value,
+void set_ro_build_prop(const std::string& prop, const std::string& value,
                        bool product = true) {
     std::string prop_name;
-    std::string prop_types[] = {
-        "",
-        "bootimage.",
-        "odm.",
-        "odm_dlkm.",
-        "product.",
-        "system.",
-        "system_ext.",
-        "vendor.",
-        "vendor_dlkm.",
-    };
+    std::vector<std::string> prop_types = {
+            "",        "bootimage.",  "odm.",    "odm_dlkm.",   "product.",
+            "system.", "system_ext.", "vendor.", "vendor_dlkm."};
 
-    for (const std::string &source : prop_types) {
+    for (const auto& source : prop_types) {
         if (product) {
             prop_name = "ro.product." + source + prop;
         } else {
             prop_name = "ro." + source + "build." + prop;
         }
 
-        property_override(prop_name, value, false);
+        property_override(prop_name.c_str(), value.c_str(), false);
     }
 }
 
-std::tuple<std::string, std::string> get_device() {
-    std::string device, model, line;
-    std::ifstream operator_file(PROC_OPERATOR);
-    operator_file.good();
-    getline(operator_file, line);
+DeviceProps get_device() {
+    std::string device, model, operator_content;
+    if (!android::base::ReadFileToString(kProcOperatorPath,
+                                         &operator_content)) {
+        LOG(ERROR) << "Failed to read file: " << kProcOperatorPath;
+        return {"", ""};
+    }
 
-    int operatorName = stoi(line);
+    int operator_code = stoi(operator_content);
 
-    switch (operatorName) {
+    DeviceProps device_props;
+    switch (operator_code) {
         // realme 6
         case 101:
         case 102:
         case 104:
         case 105:
-            device = "RMX2001L1";
-            model = "RMX2001";
+            device_props = {"RMX2001", "RMX2001L1"};
             break;
         case 106:
-            device = "RMX2003L1";
-            model = "RMX2003";
+            device_props = {"RMX2003", "RMX2003L1"};
             break;
         case 113:
-            device = "RMX2005L1";
-            model = "RMX2005";
+            device_props = {"RMX2005", "RMX2005L1"};
             break;
         // realme 6i/6s/Narzo
         case 111:
         case 112:
         case 114:
-            device = "RMX2002L1";
-            model = "RMX2002";
+            device_props = {"RMX2002", "RMX2002L1"};
             break;
         // realme 7
         case 140:
         case 141:
         case 146:
         case 149:
-            device = "RMX2151L1";
-            model = "RMX2151";
+            device_props = {"RMX2151", "RMX2151L1"};
             break;
         case 142:
-            device = "RMX2153L1";
-            model = "RMX2153";
+            device_props = {"RMX2153", "RMX2153L1"};
             break;
         case 94:
         case 148:
-            device = "RMX2155L1";
-            model = "RMX2155";
+            device_props = {"RMX2155", "RMX2155L1"};
             break;
         // realme Narzo 30 4G
         case 90:
         case 92:
-            device = "RMX2156L1";
-            model = "RMX2156";
+            device_props = {"RMX2156", "RMX2156L1"};
             break;
         // realme Narzo 20 Pro
         case 143:
-            device = "RMX2161L1";
-            model = "RMX2161";
+            device_props = {"RMX2161", "RMX2161L1"};
             break;
         case 145:
         case 147:
-            device = "RMX2163L1";
-            model = "RMX2163";
+            device_props = {"RMX2163", "RMX2163L1"};
             break;
         default:
-            LOG(ERROR) << "Unable to read operator from " << PROC_OPERATOR;
+            LOG(ERROR) << "Unknown operator found: " << operator_code;
+            device_props = {"", ""};
     }
-    return {device, model};
+
+    return device_props;
+}
+
+void set_device() {
+    const DeviceProps device_props = get_device();
+
+    if (!device_props.device.empty() && !device_props.model.empty()) {
+        set_ro_build_prop("device", device_props.device);
+        set_ro_build_prop("model", device_props.model);
+        set_ro_build_prop("name", device_props.model);
+        set_ro_build_prop("product", device_props.model, false);
+    }
 }
 
 void vendor_load_properties() {
 #ifndef __ANDROID_RECOVERY__
-    auto [device, model] = get_device();
-
-    set_ro_build_prop("device", device);
-    set_ro_build_prop("model", model);
-    set_ro_build_prop("name", model);
-    set_ro_build_prop("product", model, false);
+    set_device();
 #endif
 }
diff --git a/init/init_RM6785_vendor.cpp b/init/init_RM6785_vendor.cpp
index a6be8e0..85733d7 100644
--- a/init/init_RM6785_vendor.cpp
+++ b/init/init_RM6785_vendor.cpp
@@ -1,57 +1,76 @@
 //
-// Copyright (C) 2022 The LineageOS Project
+// Copyright (C) 2022-2023 The LineageOS Project
 //
 // SPDX-License-Identifier: Apache-2.0
 //
 
+#include <android-base/file.h>
 #include <android-base/logging.h>
 #include <android-base/properties.h>
-#include <fstream>
 
-#define PROC_NFC "/proc/oppo_nfc/chipset"
-#define PROC_OPERATOR "/proc/oppoVersion/operatorName"
+constexpr const char* kProcNfcPath = "/proc/oppo_nfc/chipset";
+constexpr const char* kProcOperatorPath = "/proc/oppoVersion/operatorName";
+constexpr const char* kPropPowerProfile = "ro.vendor.power_profile.device";
+constexpr const char* kPropNfcDevice = "ro.vendor.nfc_device";
 
-void set_property(std::string prop, std::string value) {
+void set_property(const std::string& prop, const std::string& value) {
     LOG(INFO) << "Setting property: " << prop << " to " << value;
-    if (!android::base::SetProperty(prop.c_str(), value.c_str()))
+    if (!android::base::SetProperty(prop, value)) {
         LOG(ERROR) << "Unable to set: " << prop << " to " << value;
+    }
 }
 
-void nfc_detect() {
-    std::string chipset;
-    std::ifstream nfc_file(PROC_NFC);
+void detect_nfc() {
+    std::string nfc_chipset;
+    if (!android::base::ReadFileToString(kProcNfcPath, &nfc_chipset)) {
+        LOG(ERROR) << "Failed to read file: " << kProcNfcPath;
+        return;
+    }
 
-    getline(nfc_file, chipset);
-
-    LOG(INFO) << "oppo_nfc : chipset " << chipset;
-
-    if (chipset != "NULL")
-        set_property("ro.vendor.nfc_device", "1");
+    if (nfc_chipset != "NULL") {
+        set_property(kPropNfcDevice, "1");
+    }
 }
 
-void power_profile() {
-    std::string op;
-    std::ifstream operator_file(PROC_OPERATOR);
+void set_power_profile() {
+    std::string device_name, operator_content;
+    if (!android::base::ReadFileToString(kProcOperatorPath,
+                                         &operator_content)) {
+        LOG(ERROR) << "Failed to read file: " << kProcOperatorPath;
+        return;
+    }
 
-    getline(operator_file, op);
+    int operator_code = stoi(operator_content);
 
-    int operatorName = stoi(op);
-
-    switch (operatorName) {
-        case 90: case 92: case 94: case 140: case 141: case 142: case 146: case 148: case 149:
-            LOG(INFO) << "operatorName: " << operatorName;
-            set_property("ro.vendor.power_profile.device", "RMX2151");
+    switch (operator_code) {
+        case 90:
+        case 92:
+        case 94:
+        case 140:
+        case 141:
+        case 142:
+        case 146:
+        case 148:
+        case 149:
+            device_name = "RMX2151";
             break;
-        case 143: case 145: case 147:
-            LOG(INFO) << "operatorName: " << operatorName;
-            set_property("ro.vendor.power_profile.device", "RMX2161");
+        case 143:
+        case 145:
+        case 147:
+            device_name = "RMX2161";
             break;
         default:
-            LOG(INFO) << "operatorName: " << operatorName;
+            LOG(ERROR) << "Unknown operator found: " << operator_code;
+    }
+
+    if (!device_name.empty()) {
+        set_property(kPropPowerProfile, device_name);
     }
 }
 
 int main() {
-    nfc_detect();
-    power_profile();
+    detect_nfc();
+    set_power_profile();
+
+    return 0;
 }
