diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index be276e5..53bbdee 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -3,15 +3,7 @@
 export const event = "roleUpdate";
 
 export async function callback(client, or, nr) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderDelta,
-        renderUser,
-        renderRole
-    } = client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderRole } = client.logger;
 
     const auditLog = await getAuditLog(nr.guild, "ROLE_UPDATE");
     const audit = auditLog.entries.first();
@@ -21,47 +13,22 @@
         roleId: entry(nr.id, `\`${nr.id}\``),
         role: entry(nr.id, renderRole(nr)),
         edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await nr.guild.members.fetch(audit.executor.id)).user)
-        )
+        editedBy: entry(audit.executor.id, renderUser((await nr.guild.members.fetch(audit.executor.id)).user))
     };
     const mentionable = ["", ""];
     const hoist = ["", ""];
-    mentionable[0] = or.mentionable
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    mentionable[1] = nr.mentionable
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    hoist[0] = or.hoist
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    hoist[1] = nr.hoist
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    if (or.name !== nr.name)
-        changes.name = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
+    mentionable[0] = or.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    mentionable[1] = nr.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    hoist[0] = or.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    hoist[1] = nr.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    if (or.name !== nr.name) changes.name = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
     if (or.position !== nr.position)
-        changes.position = entry(
-            [or.position, nr.position],
-            `${or.position} -> ${nr.position}`
-        );
-    if (or.hoist !== nr.hoist)
-        changes.showInMemberList = entry(
-            [or.hoist, nr.hoist],
-            `${hoist[0]} -> ${hoist[1]}`
-        );
+        changes.position = entry([or.position, nr.position], `${or.position} -> ${nr.position}`);
+    if (or.hoist !== nr.hoist) changes.showInMemberList = entry([or.hoist, nr.hoist], `${hoist[0]} -> ${hoist[1]}`);
     if (or.mentionable !== nr.mentionable)
-        changes.mentionable = entry(
-            [or.mentionable, nr.mentionable],
-            `${mentionable[0]} -> ${mentionable[1]}`
-        );
+        changes.mentionable = entry([or.mentionable, nr.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
     if (or.hexColor !== nr.hexColor)
-        changes.color = entry(
-            [or.hexColor, nr.hexColor],
-            `\`${or.hexColor}\` -> \`${nr.hexColor}\``
-        );
+        changes.color = entry([or.hexColor, nr.hexColor], `\`${or.hexColor}\` -> \`${nr.hexColor}\``);
 
     if (Object.keys(changes).length === 4) return;
 
