diff --git a/lib/pel_utils.py b/lib/pel_utils.py
index d12abd7..eb74ef5 100644
--- a/lib/pel_utils.py
+++ b/lib/pel_utils.py
@@ -7,6 +7,7 @@
 import func_args as fa
 import bmc_ssh_utils as bsu
 import json
+import pel_variables
 
 
 class peltool_exception(Exception):
@@ -51,77 +52,113 @@
     if parse_json:
         try:
             return json.loads(out_buf)
-        except json.JSONDecodeError:
+        except ValueError:
             return {}
     return out_buf
 
 
-def fetch_pelId_For_SRC(src_id):
+def fetch_all_pel_ids_for_src(src_id, severity):
     r"""
-    Fetch PEL ID for the input SRC ID
+    Fetch all PEL IDs for the input SRC ID based on the severity type
+    in the list format.
 
     Description of arguments:
-    src_id  SRC ID (e.g. BC20E504)
+    src_id      SRC ID (e.g. BC20E504).
+    severity    PEL severity (e.g. "Predictive Error"
+                                   "Recovered Error").
     """
 
-    src_pel_id = []
     try:
+        src_pel_ids = []
         pel_data = peltool(" -l")
         pel_id_list = pel_data.keys()
-        for i in pel_id_list:
-            if pel_data[i]["SRC"] == src_id:
-                src_pel_id.append(i)
+        for pel_id in pel_id_list:
+            # Check if required SRC ID with severity is present
+            if ((pel_data[pel_id]["SRC"] == src_id) and (pel_data[pel_id]["Sev"] == severity)):
+                src_pel_ids.append(pel_id)
+
+        if not src_pel_ids:
+            raise peltool_exception(src_id + " with severity " + severity + " not present")
     except Exception as e:
         raise peltool_exception("Failed to fetch PEL ID for required SRC : " + str(e))
-    return src_pel_id
+    return src_pel_ids
 
 
-def verify_SRC_details(pel_id, attn_type, target_type, signature_desc,
-                       threshold_limit):
+def verify_src_signature_and_threshold(pel_id, attn_type, signature_desc, th_limit):
     r"""
-    Verify SRC details for the given PEL ID based on the required
-    target type, attention type, signature description, threshold limit.
+    Verifies SRC details for the given PEL ID based on the required
+    attention type, signature description, threshold limits.
 
     Description of arguments:
-    pel_id          PEL ID for the required SRC details to verify
-    target_type     Target type (e.g. TYPE_OMIC)
-    attn_type       Attention type (e.g. RECCOVERABLE)
-    signature_desc  Signature description of the error inject
-    threshold_limit Threshold limit (e.g. 1, 5, 32)
+    pel_id          PEL ID for the required SRC details to verify.
+    attn_type       Attention type (e.g. RE, CS, UNIT_CS).
+    signature_desc  Signature description of the error inject.
+    th_limit        Threshold limit (e.g. 1, 5, 32).
     """
 
     try:
         pel_cmd = " -i " + pel_id
         src_data = peltool(pel_cmd)
         src_dict = src_data["Primary SRC"]["SRC Details"]
-        usr_data = src_data["User Data 4"]
-        if (src_dict["Attention Type"] != attn_type):
+        usr_data = src_data["User Data 1"]
+
+        # Example for signature in recoverable error
+        #
+        # "SRC Details": {
+        # "Attention Type": "RECOVERABLE",
+        # "Node": 0,
+        # "Target Type": "TYPE_OMIC",
+        # "Target Instance": 0,
+        # "Signature": "MC_OMI_DL_FIR[1]: OMI-DL0 UE on data flit"
+        # }
+        if (attn_type == "RE"):
+            if (src_dict["Attention Type"] != "RECOVERABLE"):
+                raise peltool_exception("Required Attention type " + attn_type + " not found")
+
+        # Example for signature in system checkstop error
+        #
+        # "SRC Details": {
+        # "Primary Attention": "system checkstop",
+        # "Signature Description": {
+        #    "Chip Desc": "node 0 proc 0 (P10 2.0)",
+        #    "Signature": "EQ_L2_FIR(0)[7] L2 directory read UE",
+        #    "Attn Type": "checkstop"
+        # }
+
+        elif (attn_type == "CS"):
+            if (src_dict["Primary Attention"] != "system checkstop"):
+                raise peltool_exception("Required Attention type " + attn_type + " not found")
+
+        elif (attn_type == "UNIT_CS"):
+            if (src_dict["Attention Type"] != "UNIT_CS"):
+                raise peltool_exception("Required Attention type " + attn_type + " not found")
+        else:
             raise peltool_exception("Required Attention type " + attn_type + " not found")
-        if target_type not in src_dict["Target Type"]:
-            raise peltool_exception("Required Target type " + target_type + " not found")
+
         if signature_desc not in src_dict["Signature"]:
             raise peltool_exception("Required Signature " + signature_desc + " not found")
 
-        if (int(threshold_limit) != usr_data["Error Threshold"]):
-            raise peltool_exception("Required Threshold limit " + threshold_limit + " not found")
+        if (int(th_limit) != usr_data["Error Count"]):
+            raise peltool_exception("Required Threshold limit " + th_limit + " not found")
 
     except Exception as e:
         raise peltool_exception("Failed to verify SRC details : " + str(e))
-
     return True
 
 
-def fetch_All_SRC():
+def fetch_all_src():
     r"""
-    Fetch all list of SRC IDs from peltool
+    Fetch all SRC IDs from peltool in the list format.
     """
-
-    src_id = []
     try:
+        src_id = []
         pel_data = peltool(" -l")
-        pel_id_list = pel_data.keys()
-        for i in pel_id_list:
-            src_id.append(pel_data[i]["SRC"])
+        if pel_data:
+            pel_id_list = pel_data.keys()
+            for pel_id in pel_id_list:
+                src_id.append(pel_data[pel_id]["SRC"])
+        else:
+            raise peltool_exception("No PEL entry found ..")
     except Exception as e:
         raise peltool_exception("Failed to fetch all SRCs : " + str(e))
     return src_id
