diff --git a/Makefile b/Makefile
index 7a3b6af..08900ca 100644
--- a/Makefile
+++ b/Makefile
@@ -50,13 +50,13 @@
 	$(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
 
 $(LIB_APP): $(LIB_APP_OBJ)
-	$(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
+	$(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper
 
 $(LIB_HOST_SRV): $(LIB_HOST_SRV_OBJ)
 	$(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
 
 $(DAEMON): $(DAEMON_OBJ)
-	$(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
+	$(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper -ldl
 
 $(TESTER): $(TESTER_OBJ)
 	$(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
diff --git a/chassishandler.C b/chassishandler.C
index 6a9a28f..ded9157 100644
--- a/chassishandler.C
+++ b/chassishandler.C
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
+#include <mapper.h>
 
 
 //Defines
@@ -27,80 +28,6 @@
 const char *settings_intf_name    =  "org.freedesktop.DBus.Properties";
 const char *host_intf_name        =  "org.openbmc.settings.Host";
 
-const char *objmapper_service_name =  "org.openbmc.ObjectMapper";
-const char *objmapper_object_name  =  "/org/openbmc/ObjectMapper";
-const char *objmapper_intf_name    =  "org.openbmc.ObjectMapper";
-
-int object_mapper_get_connection(char **buf, const char *obj_path)
-{
-    sd_bus_error error = SD_BUS_ERROR_NULL;
-    sd_bus_message *m = NULL;
-    sd_bus *bus = NULL;
-    char *temp_buf = NULL, *intf = NULL;
-    size_t buf_size = 0;
-    int r;
-
-    // Get the system bus where most system services are provided.
-    bus = ipmid_get_sd_bus_connection();
-
-    /*
-     * Bus, service, object path, interface and method are provided to call
-     * the method.
-     * Signatures and input arguments are provided by the arguments at the
-     * end.
-     */
-    r = sd_bus_call_method(bus,
-                           objmapper_service_name,                      /* service to contact */
-                           objmapper_object_name,                       /* object path */
-                           objmapper_intf_name,                         /* interface name */
-                           "GetObject",                                 /* method name */
-                           &error,                                      /* object to return error in */
-                           &m,                                          /* return message on success */
-                           "s",                                         /* input signature */
-                           obj_path                                     /* first argument */
-                          );
-
-    if (r < 0) {
-        fprintf(stderr, "Failed to issue method call: %s\n", error.message);
-        goto finish;
-    }
-
-    // Get the key, aka, the connection name
-    sd_bus_message_read(m, "a{sas}", 1, &temp_buf, 1, &intf);
-
-    /*
-     * TODO: check the return code. Currently for no reason the message
-     * parsing of object mapper is always complaining about
-     * "Device or resource busy", but the result seems OK for now. Need
-     * further checks.
-     * TODO: The following code is preserved in the comments so that it can be
-     * resumed after the problem aforementioned is resolved.
-     *r = sd_bus_message_read(m, "a{sas}", 1, &temp_buf, 1, &intf);
-     *if (r < 0) {
-     *    fprintf(stderr, "Failed to parse response message: %s\n", strerror(-r));
-     *    goto finish;
-     *}
-     */
-
-    buf_size = strlen(temp_buf) + 1;
-    printf("IPMID connection name: %s\n", temp_buf);
-    *buf = (char *)malloc(buf_size);
-
-    if (*buf == NULL) {
-        fprintf(stderr, "Malloc failed for get_sys_boot_options");
-        r = -1;
-        goto finish;
-    }
-
-    memcpy(*buf, temp_buf, buf_size);
-
-finish:
-    sd_bus_error_free(&error);
-    sd_bus_message_unref(m);
-
-    return r;
-}
-
 int dbus_get_property(const char *name, char **buf)
 {
     sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -110,18 +37,15 @@
     char *connection = NULL;
     int r;
 
-    r = object_mapper_get_connection(&connection, settings_object_name);
+    // Get the system bus where most system services are provided.
+    bus = ipmid_get_sd_bus_connection();
 
+    r = mapper_get_service(bus, settings_object_name, &connection);
     if (r < 0) {
         fprintf(stderr, "Failed to get connection, return value: %d.\n", r);
         goto finish;
     }
 
-    printf("connection: %s\n", connection);
-
-    // Get the system bus where most system services are provided.
-    bus = ipmid_get_sd_bus_connection();
-
     /*
      * Bus, service, object path, interface and method are provided to call
      * the method.
@@ -178,18 +102,15 @@
     char *connection = NULL;
     int r;
 
-    r = object_mapper_get_connection(&connection, settings_object_name);
+    // Get the system bus where most system services are provided.
+    bus = ipmid_get_sd_bus_connection();
 
+    r = mapper_get_service(bus, settings_object_name, &connection);
     if (r < 0) {
         fprintf(stderr, "Failed to get connection, return value: %d.\n", r);
         goto finish;
     }
 
-    printf("connection: %s\n", connection);
-
-    // Get the system bus where most system services are provided.
-    bus = ipmid_get_sd_bus_connection();
-
     /*
      * Bus, service, object path, interface and method are provided to call
      * the method.
diff --git a/ipmid.C b/ipmid.C
index 960f5dc..9590448 100644
--- a/ipmid.C
+++ b/ipmid.C
@@ -11,6 +11,7 @@
 #include "ipmid.H"
 #include <sys/time.h>
 #include <errno.h>
+#include <mapper.h>
 #include "sensorhandler.h"
 
 sd_bus *bus = NULL;
@@ -525,30 +526,40 @@
 // This will be used until an alternative is found.  this is the first
 // step for mapping IPMI
 int find_openbmc_path(const char *type, const uint8_t num, dbus_interface_t *interface) {
-
-    const char  *busname = "org.openbmc.managers.System";
+    char  *busname = NULL;
+    const char  *iface = "org.openbmc.managers.System";
     const char  *objname = "/org/openbmc/managers/System";
-
-    char  *str1, *str2, *str3;
+    char  *str1 = NULL, *str2, *str3;
     sd_bus_error error = SD_BUS_ERROR_NULL;
     sd_bus_message *reply = NULL;
 
 
     int r;
+    r = mapper_get_service(bus, objname, &busname);
+    if (r < 0) {
+        fprintf(stderr, "Failed to get system manager busname: %s\n", strerror(-r));
+        goto final;
+    }
 
-    r = sd_bus_call_method(bus,busname,objname,busname, "getObjectFromByteId",
+    r = sd_bus_call_method(bus,busname,objname,iface, "getObjectFromByteId",
                            &error, &reply, "sy", type, num);
     if (r < 0) {
         fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
         goto final;
     }
 
-    r = sd_bus_message_read(reply, "(sss)", &str1, &str2, &str3);
+    r = sd_bus_message_read(reply, "(ss)", &str2, &str3);
     if (r < 0) {
         fprintf(stderr, "Failed to get a response: %s", strerror(-r));
         goto final;
     }
 
+    r = mapper_get_service(bus, str2, &str1);
+    if (r < 0) {
+        fprintf(stderr, "Failed to get item busname: %s\n", strerror(-r));
+        goto final;
+    }
+
     strncpy(interface->bus, str1, MAX_DBUS_PATH);
     strncpy(interface->path, str2, MAX_DBUS_PATH);
     strncpy(interface->interface, str3, MAX_DBUS_PATH);
@@ -559,6 +570,8 @@
 
     sd_bus_error_free(&error);
     reply = sd_bus_message_unref(reply);
+    free(busname);
+    free(str1);
 
     return r;
 }
