diff --git a/src/api/index.ts b/src/api/index.ts
index d6d2a5a..c24327d 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -39,18 +39,16 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Verify")
-                        .setDescription("Verification complete")
+                        .setDescription("Verification complete! You can now dismiss this message")
                         .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;
+            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
             try {
                 const data = {
                     meta: {
@@ -62,8 +60,8 @@
                         timestamp: new Date().getTime()
                     },
                     list: {
-                        memberId: entry(member.id, `\`${member.id}\``),
-                        member: entry(member.id, renderUser(member.user))
+                        member: entry(member.id, renderUser(member.user)),
+                        verified: entry(member.joinedTimestamp, renderDelta(member.joinedTimestamp!))
                     },
                     hidden: {
                         guild: guild.id
@@ -89,7 +87,7 @@
                         new EmojiEmbed()
                             .setTitle("Verify")
                             .setDescription(
-                                "Verify was opened in another tab or window, please complete the CAPTCHA there to continue"
+                                "Verify was opened in another tab or window, please complete the check there to continue"
                             )
                             .setStatus("Success")
                             .setEmoji("MEMBER.JOIN")
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 405734e..7d5ac13 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -47,8 +47,9 @@
     entry = client.logger.entry;
     if (newChannel.parent && newChannel.parent.id === config.tickets.category) return;
 
-    const auditLog: GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> = (await getAuditLog(newChannel.guild, AuditLogEvent.ChannelUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildChannel)!.id === newChannel.id)[0] as GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate>;
+    const auditLog: null | GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> = (await getAuditLog(newChannel.guild, AuditLogEvent.ChannelUpdate))
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildChannel)!.id === newChannel.id)[0] as GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> | null;
+    if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
 
     let emoji: string;
@@ -86,7 +87,6 @@
                 newTopic = "None";
             }
             const nsfw = ["", ""];
-console.log((oldChannel as TextChannel).rateLimitPerUser, (newChannel as TextChannel).rateLimitPerUser);
             nsfw[0] = (oldChannel as TextChannel).nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
             nsfw[1] = (newChannel as TextChannel).nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
             if ((oldChannel as TextChannel).topic !== (newChannel as TextChannel).topic)
diff --git a/src/events/commandError.ts b/src/events/commandError.ts
index 8ed01d2..ff5f4ae 100644
--- a/src/events/commandError.ts
+++ b/src/events/commandError.ts
@@ -6,26 +6,19 @@
 export const event = "commandError";
 
 export async function callback(_: NucleusClient, interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction, error: string) {
+    const embed = new EmojiEmbed()
+        .setTitle("Something went wrong")
+        .setDescription(error)
+        .setStatus("Danger")
+        .setEmoji("CONTROL.BLOCKCROSS")
     if (interaction.replied || interaction.deferred) {
         await interaction.followUp({
-            embeds: [
-                new EmojiEmbed()
-                    .setTitle("Something went wrong")
-                    .setDescription(error)
-                    .setStatus("Danger")
-                    .setEmoji("CONTROL.BLOCKCROSS")
-            ],
+            embeds: [embed],
             ephemeral: true
         });
     } else {
         await interaction.reply({
-            embeds: [
-                new EmojiEmbed()
-                    .setTitle("Something went wrong")
-                    .setDescription(error)
-                    .setStatus("Danger")
-                    .setEmoji("CONTROL.BLOCKCROSS")
-            ],
+            embeds: [embed],
             ephemeral: true
         });
     }
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index e30fc35..8889f57 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -4,129 +4,126 @@
 export const event = "guildMemberUpdate";
 
 export async function callback(client: NucleusClient, before: GuildMember, after: GuildMember) {
-    try {
-        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
-        const auditLog = (await getAuditLog(after.guild, AuditLogEvent.EmojiCreate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0]!;
-        if (auditLog.executor!.id === client.user!.id) return;
-        if (before.nickname !== after.nickname) {
-            await client.database.history.create(
-                "nickname",
-                after.guild.id,
-                after.user,
-                auditLog.executor,
-                null,
-                before.nickname ?? before.user.username,
-                after.nickname ?? after.user.username
-            );
-            const data = {
-                meta: {
-                    type: "memberUpdate",
-                    displayName: "Nickname Changed",
-                    calculateType: "guildMemberUpdate",
-                    color: NucleusColors.yellow,
-                    emoji: "PUNISH.NICKNAME.YELLOW",
-                    timestamp: new Date().getTime()
-                },
-                list: {
-                    memberId: entry(after.id, `\`${after.id}\``),
-                    name: entry(after.user.id, renderUser(after.user)),
-                    before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
-                    after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
-                    changed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                    changedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
-                },
-                hidden: {
-                    guild: after.guild.id
-                }
-            };
-            log(data);
-        } else if (
-            (before.communicationDisabledUntilTimestamp ?? 0) < new Date().getTime() &&
-            (after.communicationDisabledUntil ?? 0) > new Date().getTime() // TODO: test this
-        ) {
-            await client.database.history.create(
-                "mute",
-                after.guild.id,
-                after.user,
-                auditLog.executor,
-                auditLog.reason,
-                null,
-                null,
-                null
-            );
-            const data = {
-                meta: {
-                    type: "memberMute",
-                    displayName: "Muted",
-                    calculateType: "guildMemberPunish",
-                    color: NucleusColors.yellow,
-                    emoji: "PUNISH.MUTE.YELLOW",
-                    timestamp: new Date().getTime()
-                },
-                list: {
-                    memberId: entry(after.id, `\`${after.id}\``),
-                    name: entry(after.user.id, renderUser(after.user)),
-                    mutedUntil: entry(
-                        after.communicationDisabledUntilTimestamp,
-                        renderDelta(after.communicationDisabledUntilTimestamp!)
-                    ),
-                    muted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                    mutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!)),
-                    reason: entry(auditLog.reason, auditLog.reason ? auditLog.reason : "\n> *No reason provided*")
-                },
-                hidden: {
-                    guild: after.guild.id
-                }
-            };
-            log(data);
-            client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil?.toISOString()!, {
-                guild: after.guild.id,
-                user: after.id,
-                expires: after.communicationDisabledUntilTimestamp
-            });
-        } else if (
-            after.communicationDisabledUntil === null &&
-            before.communicationDisabledUntilTimestamp !== null &&
-            new Date().getTime() >= auditLog.createdTimestamp
-        ) {
-            await client.database.history.create(
-                "unmute",
-                after.guild.id,
-                after.user,
-                auditLog.executor,
-                null,
-                null,
-                null,
-                null
-            );
-            const data = {
-                meta: {
-                    type: "memberUnmute",
-                    displayName: "Unmuted",
-                    calculateType: "guildMemberPunish",
-                    color: NucleusColors.green,
-                    emoji: "PUNISH.MUTE.GREEN",
-                    timestamp: new Date().getTime()
-                },
-                list: {
-                    memberId: entry(after.id, `\`${after.id}\``),
-                    name: entry(after.user.id, renderUser(after.user)),
-                    unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                    unmutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
-                },
-                hidden: {
-                    guild: after.guild.id
-                }
-            };
-            log(data);
-            client.database.eventScheduler.cancel("naturalUnmute", {
-                guild: after.guild.id,
-                user: after.id,
-                expires: before.communicationDisabledUntilTimestamp
-            });
-        }
-    } catch (e) {
-        console.log(e);
+    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
+    const auditLog = (await getAuditLog(after.guild, AuditLogEvent.EmojiCreate))
+        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0];
+    if (!auditLog) return;
+    if (auditLog.executor!.id === client.user!.id) return;
+    if (before.nickname !== after.nickname) {
+        await client.database.history.create(
+            "nickname",
+            after.guild.id,
+            after.user,
+            auditLog.executor,
+            null,
+            before.nickname ?? before.user.username,
+            after.nickname ?? after.user.username
+        );
+        const data = {
+            meta: {
+                type: "memberUpdate",
+                displayName: "Nickname Changed",
+                calculateType: "guildMemberUpdate",
+                color: NucleusColors.yellow,
+                emoji: "PUNISH.NICKNAME.YELLOW",
+                timestamp: new Date().getTime()
+            },
+            list: {
+                memberId: entry(after.id, `\`${after.id}\``),
+                name: entry(after.user.id, renderUser(after.user)),
+                before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
+                after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
+                changed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                changedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
+            },
+            hidden: {
+                guild: after.guild.id
+            }
+        };
+        log(data);
+    } else if (
+        (before.communicationDisabledUntilTimestamp ?? 0) < new Date().getTime() &&
+        (after.communicationDisabledUntil ?? 0) > new Date().getTime() // TODO: test this
+    ) {
+        await client.database.history.create(
+            "mute",
+            after.guild.id,
+            after.user,
+            auditLog.executor,
+            auditLog.reason,
+            null,
+            null,
+            null
+        );
+        const data = {
+            meta: {
+                type: "memberMute",
+                displayName: "Muted",
+                calculateType: "guildMemberPunish",
+                color: NucleusColors.yellow,
+                emoji: "PUNISH.MUTE.YELLOW",
+                timestamp: new Date().getTime()
+            },
+            list: {
+                memberId: entry(after.id, `\`${after.id}\``),
+                name: entry(after.user.id, renderUser(after.user)),
+                mutedUntil: entry(
+                    after.communicationDisabledUntilTimestamp,
+                    renderDelta(after.communicationDisabledUntilTimestamp!)
+                ),
+                muted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                mutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!)),
+                reason: entry(auditLog.reason, auditLog.reason ? auditLog.reason : "\n> *No reason provided*")
+            },
+            hidden: {
+                guild: after.guild.id
+            }
+        };
+        log(data);
+        client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil?.toISOString()!, {
+            guild: after.guild.id,
+            user: after.id,
+            expires: after.communicationDisabledUntilTimestamp
+        });
+    } else if (
+        after.communicationDisabledUntil === null &&
+        before.communicationDisabledUntilTimestamp !== null &&
+        new Date().getTime() >= auditLog.createdTimestamp
+    ) {
+        await client.database.history.create(
+            "unmute",
+            after.guild.id,
+            after.user,
+            auditLog.executor,
+            null,
+            null,
+            null,
+            null
+        );
+        const data = {
+            meta: {
+                type: "memberUnmute",
+                displayName: "Unmuted",
+                calculateType: "guildMemberPunish",
+                color: NucleusColors.green,
+                emoji: "PUNISH.MUTE.GREEN",
+                timestamp: new Date().getTime()
+            },
+            list: {
+                memberId: entry(after.id, `\`${after.id}\``),
+                name: entry(after.user.id, renderUser(after.user)),
+                unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                unmutedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
+            },
+            hidden: {
+                guild: after.guild.id
+            }
+        };
+        log(data);
+        client.database.eventScheduler.cancel("naturalUnmute", {
+            guild: after.guild.id,
+            user: after.id,
+            expires: before.communicationDisabledUntilTimestamp
+        });
     }
 }
diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index 4977c64..573da5e 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -128,7 +128,7 @@
                     new EmojiEmbed()
                         .setTitle("Verify")
                         .setDescription(
-                            "Your avatar was detected as NSFW, which we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake" +
+                            "Your avatar was detected as NSFW, which we do not allow in this server.\nPlease contact a staff members if you believe this is a mistake" +
                                 step(1)
                         )
                         .setStatus("Danger")
