diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index 3a01c46..7056fe6 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -1,6 +1,5 @@
 import { unknownServerIcon } from './../utils/defaults.js';
 import {
-    Interaction,
     ButtonBuilder,
     CommandInteraction,
     ButtonStyle,
@@ -8,7 +7,8 @@
     StringSelectMenuOptionBuilder,
     StringSelectMenuBuilder,
     GuildMemberRoleManager,
-    Role
+    Role,
+    ContextMenuCommandInteraction
 } from "discord.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import { ActionRowBuilder } from "discord.js";
@@ -27,7 +27,7 @@
     user: string;
     username: string;
     data: GuildConfig["roleMenu"]["options"];
-    interaction: Interaction;
+    interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction;
 }
 
 export async function callback(interaction: CommandInteraction | ButtonInteraction) {
@@ -95,7 +95,7 @@
                     user: interaction.member!.user.id,
                     username: interaction.member!.user.username,
                     data: config.roleMenu.options,
-                    interaction: interaction as Interaction
+                    interaction: interaction as CommandInteraction | ButtonInteraction
                 };
             }
             await interaction.editReply({
diff --git a/src/api/index.ts b/src/api/index.ts
index d0df639..d6d2a5a 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -1,3 +1,4 @@
+import type { Guild, GuildMember } from 'discord.js';
 import type { NucleusClient } from '../utils/client.js';
 //@ts-expect-error
 import express from "express";
@@ -12,19 +13,19 @@
 const port = 10000;
 
 const runServer = (client: NucleusClient) => {
-    app.get("/", (req, res) => {
+    app.get("/", (_req: express.Request, res: express.Response) => {
         res.status(200).send(client.ws.ping);
     });
 
-    app.post("/verify/:code", jsonParser, async function (req, res) {
+    app.post("/verify/:code", jsonParser, async function (req: express.Request, res: express.Response) {
         const code = req.params.code;
         const secret = req.body.secret;
         if (secret === client.config.verifySecret) {
-            const guild = await client.guilds.fetch(client.verify[code]!.gID);
+            const guild = await client.guilds.fetch(client.verify[code]!.gID) as Guild | null;
             if (!guild) {
                 return res.status(404);
             }
-            const member = await guild.members.fetch(client.verify[code]!.uID);
+            const member = await guild.members.fetch(client.verify[code]!.uID) as GuildMember | null;
             if (!member) {
                 return res.status(404);
             }
@@ -34,19 +35,21 @@
             await member.roles.add(client.verify[code]!.rID);
 
             const interaction = client.verify[code]!.interaction;
-            if (interaction) {
-                interaction.editReply({
-                    embeds: [
-                        new EmojiEmbed()
-                            .setTitle("Verify")
-                            .setDescription("Verification complete")
-                            .setStatus("Success")
-                            .setEmoji("MEMBER.JOIN")
-                    ],
-                    components: []
-                });
-            }
-            client.verify = client.verify.filter((v) => v.code !== code);
+            interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Verify")
+                        .setDescription("Verification complete")
+                        .setStatus("Success")
+                        .setEmoji("MEMBER.JOIN")
+                ],
+                components: []
+            });
+            // client.verify.filter((v: VerifySchema) => v.code !== code);
+            // delete the key by creating a new object without the key
+            client.verify = Object.keys(client.verify)
+                .filter((k) => k !== code)
+                .reduce((obj, key) => {return { ...obj, [key]: client.verify[key]}}, {});
             const { log, NucleusColors, entry, renderUser } = client.logger;
             try {
                 const data = {
@@ -76,24 +79,22 @@
         }
     });
 
-    app.get("/verify/:code", jsonParser, function (req, res) {
+    app.get("/verify/:code", jsonParser, function (req: express.Request, res: express.Response) {
         const code = req.params.code;
         if (client.verify[code]) {
             try {
                 const interaction = client.verify[code]!.interaction;
-                if (interaction) {
-                    interaction.editReply({
-                        embeds: [
-                            new EmojiEmbed()
-                                .setTitle("Verify")
-                                .setDescription(
-                                    "Verify was opened in another tab or window, please complete the CAPTCHA there to continue"
-                                )
-                                .setStatus("Success")
-                                .setEmoji("MEMBER.JOIN")
-                        ]
-                    });
-                }
+                interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Verify")
+                            .setDescription(
+                                "Verify was opened in another tab or window, please complete the CAPTCHA there to continue"
+                            )
+                            .setStatus("Success")
+                            .setEmoji("MEMBER.JOIN")
+                    ]
+                });
             } catch {
                 return res.sendStatus(410);
             }
@@ -104,15 +105,15 @@
         return res.sendStatus(404);
     });
 
-    app.post("/rolemenu/:code", jsonParser, async function (req, res) {
+    app.post("/rolemenu/:code", jsonParser, async function (req: express.Request, res: express.Response) {
         const code = req.params.code;
         const secret = req.body.secret;
         if (secret === client.config.verifySecret) {
-            const guild = await client.guilds.fetch(client.roleMenu[code]!.guild);
+            const guild = await client.guilds.fetch(client.roleMenu[code]!.guild) as Guild | null;
             if (!guild) {
                 return res.status(404);
             }
-            const member = await guild.members.fetch(client.roleMenu[code]!.user);
+            const member = await guild.members.fetch(client.roleMenu[code]!.user) as GuildMember | null;
             if (!member) {
                 return res.status(404);
             }
@@ -122,25 +123,23 @@
         }
     });
 
-    app.get("/rolemenu/:code", jsonParser, function (req, res) {
+    app.get("/rolemenu/:code", jsonParser, function (req: express.Request, res: express.Response) {
         const code = req.params.code;
         if (client.roleMenu[code] !== undefined) {
             try {
                 const interaction = client.roleMenu[code]!.interaction;
-                if (interaction) {
-                    interaction.editReply({
-                        embeds: [
-                            new EmojiEmbed()
-                                .setTitle("Roles")
-                                .setDescription(
-                                    "The role menu was opened in another tab or window, please select your roles there to continue"
-                                )
-                                .setStatus("Success")
-                                .setEmoji("GUILD.GREEN")
-                        ],
-                        components: []
-                    });
-                }
+                interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Roles")
+                            .setDescription(
+                                "The role menu was opened in another tab or window, please select your roles there to continue"
+                            )
+                            .setStatus("Success")
+                            .setEmoji("GUILD.GREEN")
+                    ],
+                    components: []
+                });
             } catch {
                 return res.sendStatus(410);
             }
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index 9c163a7..b176dd4 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -91,7 +91,7 @@
     const rulesChannel = interaction.guild!.rulesChannel?.id;
 
     async function nameFromChannel(channel: GuildBasedChannel): Promise<string> {
-        let channelType = channel.type;
+        let channelType: Discord.ChannelType | 99 = channel.type;
         if (channelType === Discord.ChannelType.GuildCategory) return "";
         if (channel.id === rulesChannel) channelType = 99
         let threads: Discord.ThreadChannel[] = [];
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index 6d823b2..fbe79fa 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,11 +1,11 @@
 import { LoadingEmbed } from "../../../utils/defaults.js";
 import Discord, { CommandInteraction, Message, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import { SlashCommandSubcommandBuilder, StringSelectMenuOptionBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import client from "../../../utils/client.js";
 import { toHexArray, toHexInteger } from "../../../utils/calculate.js";
 
-const logs = {
+const logs: Record<string, string> = {
     channelUpdate: "Channels created, deleted or modified",
     emojiUpdate: "Server emojis modified",
     stickerUpdate: "Server stickers modified",
@@ -42,6 +42,18 @@
     do {
         const config = await client.database.guilds.read(interaction.guild!.id);
         const converted = toHexArray(config.logging.logs.toLog);
+        const selectPane = new StringSelectMenuBuilder()
+            .setPlaceholder("Set events to log")
+            .setMaxValues(Object.keys(logs).length)
+            .setCustomId("logs")
+            .setMinValues(0)
+        Object.keys(logs).map((e, i) => {
+            selectPane.addOptions(new StringSelectMenuOptionBuilder()
+                .setLabel(logs[e]!)
+                .setValue(i.toString())
+                .setDefault(converted.includes(e))
+            )
+        });
         m = (await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
@@ -53,20 +65,7 @@
                     .setEmoji("CHANNEL.TEXT.CREATE")
             ],
             components: [
-                new ActionRowBuilder<StringSelectMenuBuilder>().addComponents([
-                    new StringSelectMenuBuilder()
-                        .setPlaceholder("Set events to log")
-                        .setMaxValues(Object.keys(logs).length)
-                        .setCustomId("logs")
-                        .setMinValues(0)
-                        .setOptions(
-                            Object.keys(logs).map((e, i) => ({
-                                label: (logs as any)[e],
-                                value: i.toString(),
-                                default: converted.includes(e)
-                            }))
-                        )
-                ]),
+                new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectPane),
                 new ActionRowBuilder<ButtonBuilder>().addComponents([
                     new ButtonBuilder().setLabel("Select all").setStyle(ButtonStyle.Primary).setCustomId("all"),
                     new ButtonBuilder().setLabel("Select none").setStyle(ButtonStyle.Danger).setCustomId("none")
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index ff545aa..892a420 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -7,7 +7,6 @@
     GuildChannel,
     Message,
     ActionRowBuilder,
-    Component,
     ButtonBuilder,
     MessageComponentInteraction,
     StringSelectMenuBuilder,
@@ -74,9 +73,9 @@
     })) as Message;
     const options = {
         enabled: (interaction.options.get("enabled")?.value as string).startsWith("yes") as boolean | null,
-        category: interaction.options.get("category")?.channel,
-        maxtickets: interaction.options.get("maxticketsperuser")?.value as number,
-        supportping: interaction.options.get("supportrole")?.role as Role
+        category: interaction.options.get("category")?.channel as Discord.CategoryChannel | null,
+        maxtickets: interaction.options.get("maxticketsperuser")?.value as number | null,
+        supportping: interaction.options.get("supportrole")?.role as Role | null
     };
     if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
         if (options.category) {
@@ -94,7 +93,6 @@
                     ]
                 });
             }
-            if (!channel) return;
             channel = channel as Discord.CategoryChannel;
             if (channel.guild.id !== interaction.guild.id)
                 return interaction.editReply({
@@ -202,20 +200,20 @@
             });
         }
     }
-    let data = await client.database.guilds.read(interaction.guild.id);
-    data.tickets.customTypes = (data.tickets.customTypes || []).filter(
+    const data = await client.database.guilds.read(interaction.guild.id);
+    data.tickets.customTypes = (data.tickets.customTypes ?? []).filter(
         (value: string, index: number, array: string[]) => array.indexOf(value) === index
     );
     let lastClicked = "";
-    let embed: EmojiEmbed = new EmojiEmbed();
-    let compiledData = {
+    const embed: EmojiEmbed = new EmojiEmbed();
+    const compiledData = {
         enabled: data.tickets.enabled,
         category: data.tickets.category,
         maxTickets: data.tickets.maxTickets,
         supportRole: data.tickets.supportRole,
         useCustom: data.tickets.useCustom,
         types: data.tickets.types,
-        customTypes: data.tickets.customTypes
+        customTypes: data.tickets.customTypes as string[] | null
     };
     let timedOut = false;
     while (!timedOut) {
@@ -485,29 +483,27 @@
                         continue;
                     }
                     out = out as ModalSubmitInteraction;
-                    if (out.fields) {
-                        const title = out.fields.getTextInputValue("title");
-                        const description = out.fields.getTextInputValue("description");
-                        await interaction.channel!.send({
-                            embeds: [
-                                new EmojiEmbed()
-                                    .setTitle(title)
-                                    .setDescription(description)
-                                    .setStatus("Success")
-                                    .setEmoji("GUILD.TICKET.OPEN")
-                            ],
-                            components: [
-                                new ActionRowBuilder<ButtonBuilder>().addComponents([
-                                    new ButtonBuilder()
-                                        .setLabel("Create Ticket")
-                                        .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
-                                        .setStyle(ButtonStyle.Success)
-                                        .setCustomId("createticket")
-                                ])
-                            ]
-                        });
-                        templateSelected = true;
-                    }
+                    const title = out.fields.getTextInputValue("title");
+                    const description = out.fields.getTextInputValue("description");
+                    await interaction.channel!.send({
+                        embeds: [
+                            new EmojiEmbed()
+                                .setTitle(title)
+                                .setDescription(description)
+                                .setStatus("Success")
+                                .setEmoji("GUILD.TICKET.OPEN")
+                        ],
+                        components: [
+                            new ActionRowBuilder<ButtonBuilder>().addComponents([
+                                new ButtonBuilder()
+                                    .setLabel("Create Ticket")
+                                    .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
+                                    .setStyle(ButtonStyle.Success)
+                                    .setCustomId("createticket")
+                            ])
+                        ]
+                    });
+                    templateSelected = true;
                 }
             }
         } else if ((i.component as ButtonComponent).customId === "enabled") {
@@ -516,7 +512,7 @@
             });
             compiledData.enabled = !compiledData.enabled;
         } else if ((i.component as ButtonComponent).customId === "manageTypes") {
-            data = await manageTypes(interaction, data, m as Message); //TODO: Fix this
+            data.tickets = await manageTypes(interaction, data.tickets, m as Message);
         }
     }
     await interaction.editReply({
@@ -713,24 +709,20 @@
                 continue;
             }
             out = out as ModalSubmitInteraction;
-            if (out.fields) {
-                let toAdd = out.fields.getTextInputValue("type");
-                if (!toAdd) {
-                    continue;
-                }
-                toAdd = toAdd.substring(0, 80);
-                try {
-                    await client.database.guilds.append(interaction.guild!.id, "tickets.customTypes", toAdd);
-                } catch {
-                    continue;
-                }
-                data.customTypes = data.customTypes ?? [];
-                if (!data.customTypes.includes(toAdd)) {
-                    data.customTypes.push(toAdd);
-                }
-            } else {
+            let toAdd = out.fields.getTextInputValue("type");
+            if (!toAdd) {
                 continue;
             }
+            toAdd = toAdd.substring(0, 80);
+            try {
+                await client.database.guilds.append(interaction.guild!.id, "tickets.customTypes", toAdd);
+            } catch {
+                continue;
+            }
+            data.customTypes = data.customTypes ?? [];
+            if (!data.customTypes.includes(toAdd)) {
+                data.customTypes.push(toAdd);
+            }
         } else if ((i.component as ButtonComponent).customId === "switchToDefault") {
             i.deferUpdate();
             await client.database.guilds.write(interaction.guild!.id, { "tickets.useCustom": false }, []);
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 983b82f..0814cfa 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -1,5 +1,5 @@
 import { LoadingEmbed } from "../../utils/defaults.js";
-import Discord, { CommandInteraction, GuildMember, Message, ActionRowBuilder, ButtonBuilder, ButtonStyle, SelectMenuOptionBuilder, APIMessageComponentEmoji, StringSelectMenuBuilder, MessageComponentInteraction, StringSelectMenuInteraction, Role } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, Message, ActionRowBuilder, ButtonBuilder, ButtonStyle, SelectMenuOptionBuilder, APIMessageComponentEmoji, StringSelectMenuBuilder, MessageComponentInteraction, StringSelectMenuInteraction } from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -36,7 +36,7 @@
     let timedOut = false;
     while (!timedOut) {
         const data = config.tracks[track]!;
-        if (data.manageableBy !== undefined)
+        if (data.manageableBy.length)
             managed = data.manageableBy.some((element: string) => {
                 return memberRoles.cache.has(element);
             });
@@ -94,7 +94,7 @@
         }
         const conflict = data.retainPrevious ? false : selected.length > 1;
         let conflictDropdown: StringSelectMenuBuilder[] = [];
-        let conflictDropdownOptions: SelectMenuOptionBuilder[] = [];
+        const conflictDropdownOptions: SelectMenuOptionBuilder[] = [];
         let currentRoleIndex: number = -1;
         if (conflict) {
             generated += `\n\n${getEmojiByName(`PUNISH.WARN.${managed ? "YELLOW" : "RED"}`)} This user has ${
@@ -202,7 +202,7 @@
                 }
             }
         } else if (component.customId === "select") {
-            track = (component as StringSelectMenuInteraction).values[0];
+            track = parseInt((component as StringSelectMenuInteraction).values[0]!);
         }
     }
 };
@@ -215,9 +215,10 @@
     if (member.id === interaction.guild!.ownerId) return true;
     // Check if the user can manage any of the tracks
     let managed = false;
+    const memberRoles = member.roles.cache.map((r) => r.id)
     for (const element of tracks) {
-        if (!element.track.manageableBy) continue;
-        if (!element.track.manageableBy.some((role: Role) => member.roles.cache.has(role.id))) continue;
+        if (!element.manageableBy.length) continue;
+        if (!element.manageableBy.some((role: string) => memberRoles.includes(role))) continue;
         managed = true;
         break;
     }
diff --git a/src/config/format.ts b/src/config/format.ts
index 9cd5211..53aba72 100644
--- a/src/config/format.ts
+++ b/src/config/format.ts
@@ -1,4 +1,5 @@
 import fs from "fs";
+// @ts-expect-error
 import * as readLine from "node:readline/promises";
 
 const defaultDict: Record<string, string | string[] | boolean> = {
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 9730e17..405734e 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -92,9 +92,9 @@
             if ((oldChannel as TextChannel).topic !== (newChannel as TextChannel).topic)
                 changes.description = entry([(oldChannel as TextChannel).topic ?? "", (newChannel as TextChannel).topic ?? ""], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
             if ((oldChannel as TextChannel).nsfw !== (newChannel as TextChannel).nsfw) changes.nsfw = entry([(oldChannel as TextChannel).nsfw ? "On" : "Off", (newChannel as TextChannel).nsfw ? "On" : "Off"], `${nsfw[0]} -> ${nsfw[1]}`);
-            if ((oldChannel as TextChannel).rateLimitPerUser !== (newChannel as TextChannel).rateLimitPerUser && (oldChannel as TextChannel).rateLimitPerUser !== undefined)
+            if ((oldChannel as TextChannel).rateLimitPerUser !== (newChannel as TextChannel).rateLimitPerUser && (oldChannel as TextChannel).rateLimitPerUser !== 0)
                 changes.rateLimitPerUser = entry(
-                    [((oldChannel as TextChannel).rateLimitPerUser ?? 0).toString(), ((newChannel as TextChannel).rateLimitPerUser ?? 0).toString()],
+                    [((oldChannel as TextChannel).rateLimitPerUser).toString(), ((newChannel as TextChannel).rateLimitPerUser).toString()],
                     `${humanizeDuration((oldChannel as TextChannel).rateLimitPerUser * 1000)} -> ${humanizeDuration((newChannel as TextChannel).rateLimitPerUser * 1000)}`
                 );
 
@@ -103,7 +103,7 @@
         case ChannelType.GuildAnnouncement: {
             emoji = "CHANNEL.TEXT.EDIT";
             readableType = "Announcement";
-            displayName = "Announcment Channel";
+            displayName = "Announcement Channel";
             let oldTopic = (oldChannel as TextChannel).topic,
                 newTopic = (newChannel as TextChannel).topic;
             if (oldTopic) {
@@ -138,7 +138,7 @@
             if ((oldChannel as VoiceChannel).rtcRegion !== (newChannel as VoiceChannel).rtcRegion)
                 changes.region = entry(
                     [(oldChannel as VoiceChannel).rtcRegion ?? "Automatic", (newChannel as VoiceChannel).rtcRegion ?? "Automatic"],
-                    `${(oldChannel as VoiceChannel).rtcRegion?.toUpperCase() || "Automatic"} -> ${(newChannel as VoiceChannel).rtcRegion?.toUpperCase() || "Automatic"}`
+                    `${(oldChannel as VoiceChannel).rtcRegion?.toUpperCase() ?? "Automatic"} -> ${(newChannel as VoiceChannel).rtcRegion?.toUpperCase() ?? "Automatic"}`
                 );
             break;
         }
@@ -172,7 +172,7 @@
             if ((oldChannel as StageChannel).rtcRegion !== (newChannel as StageChannel).rtcRegion)
                 changes.region = entry(
                     [(oldChannel as StageChannel).rtcRegion ?? "Automatic", (newChannel as StageChannel).rtcRegion ?? "Automatic"],
-                    `${(oldChannel as StageChannel).rtcRegion?.toUpperCase() || "Automatic"} -> ${(newChannel as StageChannel).rtcRegion?.toUpperCase() || "Automatic"}`
+                    `${(oldChannel as StageChannel).rtcRegion?.toUpperCase() ?? "Automatic"} -> ${(newChannel as StageChannel).rtcRegion?.toUpperCase() ?? "Automatic"}`
                 );
             break;
         }
@@ -188,7 +188,7 @@
             displayName = "Channel";
         }
     }
-    let ocType = channelTypeEmoji[oldChannel.type],
+    const ocType = channelTypeEmoji[oldChannel.type],
         ncType = channelTypeEmoji[newChannel.type];
     if (oldChannel.type !== newChannel.type)
         changes.type = entry([ocType!, ncType!], `${ocType!} -> ${readableType}`);
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index 936f8c2..e70fb3c 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -11,7 +11,7 @@
     await statsChannelRemove(client, member);
     const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
     const auditLog = (await getAuditLog(member.guild as Guild, AuditLogEvent.MemberKick))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === member.id)[0]!;
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === member.id)[0];
     let type = "leave";
     if (auditLog) {
         if (auditLog.executor!.id === client.user!.id) return;
@@ -21,6 +21,7 @@
     }
     let data;
     if (type === "kick") {
+        if (!auditLog) return;
         await client.database.history.create("kick", member.guild.id, member.user, auditLog.executor, auditLog.reason);
         data = {
             meta: {
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index 7dcaf5a..b341ae9 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -6,7 +6,7 @@
 export async function callback(client: NucleusClient, sticker: Sticker) {
     const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
     const auditLog = (await getAuditLog(sticker.guild!, AuditLogEvent.EmojiCreate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id)[0] as GuildAuditLogsEntry;
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id)[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
         meta: {
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index 3f1b741..ce26a85 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -6,7 +6,7 @@
 export async function callback(client: NucleusClient, sticker: Sticker) {
     const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
     const auditLog = (await getAuditLog(sticker.guild!, AuditLogEvent.StickerDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id)[0] as GuildAuditLogsEntry;
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id)[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
         meta: {
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index cc11726..ed01b71 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -8,7 +8,7 @@
 
     if (oldSticker.name === newSticker.name) return;
     const auditLog = (await getAuditLog(newSticker.guild!, AuditLogEvent.StickerUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === newSticker.id)[0] as GuildAuditLogsEntry;
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === newSticker.id)[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
 
     const changes = {
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index 14516b3..6d3225c 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -7,7 +7,7 @@
 export async function callback(client: NucleusClient, thread: ThreadChannel) {
     const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
     const auditLog = (await getAuditLog(thread.guild, AuditLogEvent.ThreadCreate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id)[0] as GuildAuditLogsEntry;
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id)[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const category = thread.parent
         ? entry(
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index 1957e80..429f63a 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -7,7 +7,7 @@
 export async function callback(client: NucleusClient, thread: ThreadChannel) {
     const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
     const auditLog = (await getAuditLog(thread.guild, AuditLogEvent.ThreadDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id)[0] as GuildAuditLogsEntry;
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id)[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const category = thread.parent
         ? entry(
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index bcf73fa..555b17f 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -8,7 +8,7 @@
 export async function callback(client: NucleusClient, oldThread: ThreadChannel, newThread: ThreadChannel) {
     const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
     const auditLog = (await getAuditLog(newThread.guild, AuditLogEvent.ThreadUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === newThread.id)[0] as GuildAuditLogsEntry;
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === newThread.id)[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const list: Record<string, ReturnType<typeof entry>> = {
         threadId: entry(newThread.id, `\`${newThread.id}\``),
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index 21fec73..e5f07dd 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -12,17 +12,19 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
         const auditCreate = (await getAuditLog(channel.guild, AuditLogEvent.WebhookCreate))
-            .filter((entry: GuildAuditLogsEntry) => (entry.target as Webhook)!.id === channel.id)[0] as GuildAuditLogsEntry;
+            .filter((entry: GuildAuditLogsEntry) => (entry.target as Webhook)!.id === channel.id)[0]!;
         const auditDelete = (await getAuditLog(channel.guild, AuditLogEvent.WebhookDelete))
-            .filter((entry: GuildAuditLogsEntry) => (entry.target as Webhook)!.id === channel.id)[0] as GuildAuditLogsEntry;
+            .filter((entry: GuildAuditLogsEntry) => (entry.target as Webhook)!.id === channel.id)[0];
         const auditUpdate = (await getAuditLog(channel.guild, AuditLogEvent.WebhookUpdate))
-            .filter((entry: GuildAuditLogsEntry) => (entry.target as Webhook)!.id === channel.id)[0] as GuildAuditLogsEntry;
+            .filter((entry: GuildAuditLogsEntry) => (entry.target as Webhook)!.id === channel.id)[0];
 
-        if (!auditCreate && !auditUpdate && !auditDelete) return;
-        let audit = auditCreate;
+        if (!auditUpdate && !auditDelete) return;
         let action: "Create" | "Update" | "Delete" = "Create";
         let list: Record<string, ReturnType<typeof entry> | string> = {};
-        if (auditUpdate && auditUpdate.createdTimestamp > audit.createdTimestamp) {
+        const createTimestamp = auditCreate.createdTimestamp;
+        const deleteTimestamp = auditDelete ? auditDelete.createdTimestamp : 0;
+        const updateTimestamp = auditUpdate ? auditUpdate.createdTimestamp : 0;
+        if (updateTimestamp > createTimestamp && updateTimestamp > deleteTimestamp && auditUpdate) {
             const { before, after } = auditUpdate.changes.reduce((acc: accType, change) => {
                     acc.before[change.key] = change.old?.toString()!;
                     acc.after[change.key] = change.new?.toString()!;
@@ -46,9 +48,8 @@
             );
             list["edited"] = entry(after["editedTimestamp"]!, renderDelta(new Date().getTime()));
             list["editedBy"] = entry(auditUpdate.executor!.id, renderUser(auditUpdate.executor!));
-            audit = auditUpdate;
             action = "Update";
-        } else if (auditDelete && auditDelete.createdTimestamp > audit.createdTimestamp) {
+        } else if (deleteTimestamp > createTimestamp && deleteTimestamp > updateTimestamp && auditDelete) {
             const { before } = auditDelete.changes.reduce((acc: accType, change) => {
                     acc.before[change.key] = change.old?.toString()!;
                     acc.after[change.key] = change.new?.toString()!;
@@ -59,17 +60,16 @@
             list = {
                 name: entry(before["name"]!, `${before["name"]}`),
                 channel: entry(before["channel_id"]!, renderChannel((await client.channels.fetch(before["channel_id"]!)) as GuildChannel)),
-                created: entry((auditUpdate.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp, renderDelta((auditUpdate.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp)),
+                created: entry((auditDelete.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp, renderDelta((auditDelete.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp)),
                 deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 deletedBy: entry(
                     auditDelete.executor!.id,
                     renderUser((await channel.guild.members.fetch(auditDelete.executor!.id)).user)
                 )
             };
-            audit = auditDelete;
             action = "Delete";
         } else {
-            const { before } = auditDelete.changes.reduce((acc: accType, change) => {
+            const { before } = auditDelete!.changes.reduce((acc: accType, change) => {
                     acc.before[change.key] = change.old?.toString()!;
                     acc.after[change.key] = change.new?.toString()!;
                     return acc;
@@ -96,7 +96,7 @@
                 type: "webhook" + action,
                 displayName: `Webhook ${action}d`,
                 calculateType: "webhookUpdate",
-                color: (NucleusColors as any)[cols[action]],
+                color: NucleusColors[cols[action] as keyof typeof NucleusColors],
                 emoji: "WEBHOOK." + action.toUpperCase(),
                 timestamp: new Date().getTime()
             },
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index fdae167..281be18 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -42,7 +42,7 @@
         i++;
         console.log(`${last.replace("└", " ").replace("├", "│")}  └─ ${colours.green}Loaded ${file.name} [${i} / ${files.length}]${colours.none}`)
     }
-    console.log(`Loaded ${commands.length} commands, processing...`)
+    console.log(`${colours.yellow}Loaded ${commands.length} commands, processing...`)
     const processed = []
 
     for (const subcommand of commands) {
@@ -53,7 +53,7 @@
         }
     }
 
-    console.log(`Processed ${processed.length} commands`)
+    console.log(`${colours.green}Processed ${processed.length} commands`)
     return processed;
 
 };
