diff --git a/ClicksMigratingProblems/index.js b/ClicksMigratingProblems/index.js
index 3c70cc2..ca6e63d 100644
--- a/ClicksMigratingProblems/index.js
+++ b/ClicksMigratingProblems/index.js
@@ -45,30 +45,15 @@
                     "strict": data.wordfilter.strict,
                     "loose": data.wordfilter.soft
                 },
-                "allowed": {
-                    "users": data.wordfilter.ignore.members.map(user => user.toString()),
-                    "roles": data.wordfilter.ignore.roles.map(role => role.toString()),
-                    "channels": data.wordfilter.ignore.channels.map(channel => channel.toString())
-                }
             },
             "invite": {
                 "enabled": data.invite ? data.invite.enabled : false,
-                "allowed": {
-                    "users": data.invite ? data.invite.whitelist.members.map(user => user.toString()) : [],
-                    "channels": data.invite ? data.invite.whitelist.channels.map(channel => channel.toString()) : [],
-                    "roles": data.invite ? data.invite.whitelist.roles.map(role => role.toString()) : []
-                }
+                "channels": data.invite ? data.invite.whitelist.channels.map(channel => channel.toString()) : [],
             },
             "pings": {
                 "mass": 5,
                 "everyone": true,
-                "roles": true,
-                "allowed": {
-                    "roles": [],
-                    "rolesToMention": null,
-                    "users": null,
-                    "channels": null
-                }
+                "roles": true
             }
         },
         "welcome": {
@@ -81,7 +66,7 @@
             "channel": data.welcome ? (data.welcome.message.text !== null ? data.welcome.message.channel.toString() : null) : null,
             "message": data.welcome ? (data.welcome.message.text) : null
         },
-        "stats": [],
+        "stats": {},
         "logging": {
             "logs": {
                 "enabled": true,
diff --git a/ClicksMigratingProblems/randomPunishments.js b/ClicksMigratingProblems/randomPunishments.js
index a2d9bf5..cf0575d 100644
--- a/ClicksMigratingProblems/randomPunishments.js
+++ b/ClicksMigratingProblems/randomPunishments.js
@@ -18,9 +18,9 @@
         guild: "864185037078790195",
         moderator: (["unban", "ban", "softban", "kick", "mute", "purge", "warn"].includes(type)) ? "438733159748599813" : null,
         reason: (["unban", "ban", "softban", "kick", "mute", "purge", "warn"].includes(type)) ? "Test" : null,
-        before: (type == "nickname") ? "TestBefore" : null,
-        after: (type == "nickname") ? "TestAfter" : null,
-        amount: (type == "purge") ? Math.floor(Math.random() * 100) : null,
+        before: (type === "nickname") ? "TestBefore" : null,
+        after: (type === "nickname") ? "TestAfter" : null,
+        amount: (type === "purge") ? Math.floor(Math.random() * 100) : null,
     });
     console.log("Inserted document " + i);
 }
diff --git a/TODO b/TODO
index 75cfb41..cdcd42a 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,15 @@
 Role all
 Server rules
-A way to add buttons to verify / role menu
\ No newline at end of file
+! A way to add buttons to verify / role menu
+
+ROLE MENU SETTINGS
+
+**Title**
+> Description
+name: role
+name: role
+name: role
+
+[ Select an option to remove                        ]
+[ Reorder roles                                     ]
+< Previous page | Add role | Delete page | Add page >
diff --git a/TODO.json b/TODO.json
index ff02831..7a13d1e 100644
--- a/TODO.json
+++ b/TODO.json
@@ -1,39 +1,40 @@
+
 {
-  "logging": {
-    "logs": {
-      "enabled": true,
-      "toLog": "3fffff"
-    }
-  },
-  "filters": {
-    "images": {
-      "NSFW": false,
-      "size": false
-    },
-    "malware": false,
-    "wordFilter": {
-      "enabled": true,
-      "words": {
-        "strict": [],
-        "loose": []
-      }
-    },
-    "invite": {
-      "enabled": false,
-      "channels": []
-    },
-    "pings": {
-      "mass": 5,
-      "everyone": true,
-      "roles": true
-    }
-  },
-  "roleMenu": [],
-  "tracks": [],
-  "welcome": {
-    "enabled": false,
-    "welcomeRole": null,
-    "channel": null,
-    "message": null
-  }
+	"logging": {
+		"logs": {
+			"enabled": true,
+			"toLog": "3fffff"
+		}
+	},
+	"filters": {
+		"images": {
+			"NSFW": false,
+			"size": false
+		},
+		"malware": false,
+		"wordFilter": {
+			"enabled": true,
+			"words": {
+				"strict": [],
+				"loose": []
+			}
+		},
+		"invite": {
+			"enabled": false,
+			"channels": []
+		},
+		"pings": {
+			"mass": 5,
+			"everyone": true,
+			"roles": true
+		}
+	},
+	"roleMenu": [],
+	"tracks": [],
+	"welcome": {
+		"enabled": false,
+		"welcomeRole": null,
+		"channel": null,
+		"message": null
+	}
 }
\ No newline at end of file
diff --git a/package.json b/package.json
index ca786a7..e42a2a5 100644
--- a/package.json
+++ b/package.json
@@ -7,14 +7,10 @@
     "discord.js": "13.8.1",
     "express": "^4.18.1",
     "fuse.js": "^6.6.2",
-    "humanize": "^0.0.9",
     "humanize-duration": "^3.27.1",
     "jshaiku": "file:../haiku",
-    "json-diff": "^0.7.1",
     "mongodb": "^4.7.0",
-    "node-tesseract": "^0.2.7",
     "node-tesseract-ocr": "^2.2.1",
-    "opencv.js": "^1.2.1",
     "pastebin-api": "^5.1.1",
     "structured-clone": "^0.2.2",
     "typescript": "^4.5.5",
@@ -23,7 +19,7 @@
   },
   "name": "nucleus",
   "version": "0.0.1",
-  "description": "Nucleus: The core Clicks bot",
+  "description": "Nucleus: The core of your server",
   "main": "dist/index.js",
   "scripts": {
     "build": "tsc",
diff --git a/src/Unfinished/all.ts b/src/Unfinished/all.ts
index 05eb603..5c482f1 100644
--- a/src/Unfinished/all.ts
+++ b/src/Unfinished/all.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
@@ -78,12 +79,7 @@
 }
 
 const callback = async (interaction: CommandInteraction) => {
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Role all")
-        .setDescription("Loading...")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true})
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true})
     let filters: Filter[] = [
         filterList.member.has.role("959901346000154674"),
         filterList.member.nickname.startsWith("Pinea"),
@@ -112,7 +108,7 @@
             .setDescription((all ? "All of the following must be true:" : "Any of the following must be true") + "\n" +
                 filters.map((f) => {
                     count ++;
-                    return (count == 1 ? getEmojiByName("ICONS.FILTER") : (all ? "**and** " : "**or** ")) +
+                    return (count === 1 ? getEmojiByName("ICONS.FILTER") : (all ? "**and** " : "**or** ")) +
                         (f.inverted ? "**not** " : "") + `${f.name}`
                 }).join("\n") + "\n\n" + `This will affect ${addPlural(affected.length, "member")}`)
             .setEmoji("GUILD.ROLES.CREATE")
@@ -144,11 +140,11 @@
 const check = async (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
-    if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the Manage roles permission";
+    if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
     // Allow the owner to role anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has manage_roles permission
-    if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the Manage roles permission";
+    if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
     // Allow role
     return true;
 }
diff --git a/src/commands/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
similarity index 92%
rename from src/commands/categorisationTest.ts
rename to src/Unfinished/categorisationTest.ts
index b052783..c75d1bb 100644
--- a/src/commands/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -1,23 +1,20 @@
+import { LoadingEmbed } from '../utils/defaultEmbeds.js';
 import { CommandInteraction, GuildChannel, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
-import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
+import { SlashCommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import client from "../utils/client.js"
 import addPlural from "../utils/plurals.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 
-const command = new SlashCommandBuilder() // TODO: remove for release
+const command = new SlashCommandBuilder()
     .setName("categorise")
     .setDescription("Categorises your servers channels")
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let channels = interaction.guild.channels.cache.filter(c => c.type !== "GUILD_CATEGORY");
     let categorised = {}
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading...")
-        .setEmoji("NUCLEUS.LOADING")
-        .setStatus("Success")
-    ], ephemeral: true});
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
     let predicted = {}
     let types = {
         general: ["general", "muted", "main", "topic", "discuss"],
diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 40f99b9..72ba011 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -16,7 +16,7 @@
         deny: ["VIEW_CHANNEL"],
         type: "role"
     })
-    if (config.tickets.supportRole != null) {
+    if (config.tickets.supportRole !== null) {
         overwrites.push({
             id: guild.roles.cache.get(config.tickets.supportRole),
             allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -40,10 +40,10 @@
     try {
         await c.send(
             {
-                content: (`<@${member.id}>` + (config.tickets.supportRole != null ? ` • <@&${config.tickets.supportRole}>` : "")),
+                content: (`<@${member.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
                 allowedMentions: {
                     users: [member.id],
-                    roles: (config.tickets.supportRole != null ? [config.tickets.supportRole] : [])
+                    roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
                 }
             }
         )
@@ -51,7 +51,7 @@
             .setTitle("New Ticket")
             .setDescription(
                 `Ticket created by a Moderator\n` +
-                `**Support type:** Appeal submission\n` + (reason != null ? `**Reason:**\n> ${reason}\n` : "") +
+                `**Support type:** Appeal submission\n` + (reason !== null ? `**Reason:**\n> ${reason}\n` : "") +
                 `**Ticket ID:** \`${c.id}\`\n` +
                 `Type \`/ticket close\` to close this ticket.`,
             )
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index a4397a3..7432a3a 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -3,6 +3,7 @@
 import { MessageActionRow, MessageSelectMenu } from 'discord.js';
 import getEmojiByName from "../utils/getEmojiByName.js";
 import client from "../utils/client.js";
+import { LoadingEmbed } from "../utils/defaultEmbeds.js";
 
 export async function callback(interaction) {
     let config = await client.database.guilds.read(interaction.guild.id);
@@ -18,12 +19,7 @@
         .setStatus("Danger")
         .setEmoji("CONTROL.BLOCKCROSS")
     ], ephemeral: true})
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Roles")
-        .setDescription("Loading...")
-        .setStatus("Success")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true})
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true})
     let m;
     if (config.roleMenu.allowWebUI) {
         let code = ""
@@ -54,7 +50,7 @@
         let up = true
         try {
             let status = await fetch(client.config.baseUrl).then(res => res.status);
-            if (status != 200) up = false
+            if (status !== 200) up = false
         } catch { up = false }
         m = await interaction.editReply({
             embeds: [new EmojiEmbed()
@@ -88,7 +84,7 @@
                     .setTitle("Roles")
                     .setEmoji("GUILD.GREEN")
                     .setDescription(`**${object.name}**` + (object.description ? `\n${object.description}` : ``) +
-                        `\n\nSelect ${object.min}` + (object.min != object.max ? ` to ${object.max}` : ``) + ` role${object.max == 1 ? '' : 's'} to add.`)
+                        `\n\nSelect ${object.min}` + (object.min !== object.max ? ` to ${object.max}` : ``) + ` role${object.max === 1 ? '' : 's'} to add.`)
                     .setStatus("Success")
                     .setFooter({text: `Step ${i + 1}/${config.roleMenu.options.length}`})
             ],
@@ -99,7 +95,7 @@
                         .setStyle("DANGER")
                         .setCustomId("cancel")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                    ].concat(object.min == 0 ? [
+                    ].concat(object.min === 0 ? [
                         new MessageButton()
                             .setLabel("Skip")
                             .setStyle("SECONDARY")
@@ -121,9 +117,9 @@
             return
         }
         component.deferUpdate()
-        if (component.customId == "rolemenu") {
+        if (component.customId === "rolemenu") {
             rolesToAdd = rolesToAdd.concat(component.values)
-        } else if (component.customId == "cancel") {
+        } else if (component.customId === "cancel") {
             return await interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Roles")
                 .setDescription("Cancelled. No changes were made.")
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index e21aa3e..722eb3f 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -24,7 +24,7 @@
     let category = interaction.guild.channels.cache.get(config.tickets.category) as Discord.CategoryChannel;
     let count = 0;
     category.children.forEach(element => {
-        if (!(element.type == "GUILD_TEXT")) return;
+        if (!(element.type === "GUILD_TEXT")) return;
         if ((element as Discord.TextChannel).topic.includes(`${interaction.member.user.id}`)) {
             if ((element as Discord.TextChannel).topic.endsWith("Active")) {
                 count++;
@@ -84,13 +84,13 @@
             if (custom) {
                 return new MessageButton()
                     .setLabel(type)
-                    .setStyle(chosenType == type ? "SUCCESS" : "SECONDARY")
+                    .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
                     .setCustomId(type)
                     .setDisabled(true)
                 } else {
                     return new MessageButton()
                     .setLabel(capitalize(type))
-                    .setStyle(chosenType == type ? "SUCCESS" : "SECONDARY")
+                    .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
                     .setCustomId(type)
                     .setEmoji(getEmojiByName(("TICKETS." + type.toString().toUpperCase()), "id"))
                     .setDisabled(true)
@@ -122,7 +122,7 @@
         deny: ["VIEW_CHANNEL"],
         type: "role"
     })
-    if (config.tickets.supportRole != null) {
+    if (config.tickets.supportRole !== null) {
         overwrites.push({
             id: interaction.guild.roles.cache.get(config.tickets.supportRole),
             allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -151,10 +151,10 @@
     try {
         await c.send(
             {
-                content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole != null ? ` • <@&${config.tickets.supportRole}>` : "")),
+                content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
                 allowedMentions: {
                     users: [(interaction.member as Discord.GuildMember).id],
-                    roles: (config.tickets.supportRole != null ? [config.tickets.supportRole] : [])
+                    roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
                 }
             }
         )
@@ -165,7 +165,7 @@
             .setTitle("New Ticket")
             .setDescription(
                 `Ticket created by <@${interaction.member.user.id}>\n` +
-                `**Support type:** ${chosenType != null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
+                `**Support type:** ${chosenType !== null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
                 `**Ticket ID:** \`${c.id}\`\n${content}\n` +
                 `Type \`/ticket close\` to close this ticket.`,
             )
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index c14cf0c..d86396a 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -10,7 +10,7 @@
     let thread = false; let threadChannel
     if (interaction.channel instanceof Discord.ThreadChannel) thread = true; threadChannel = interaction.channel as Discord.ThreadChannel
     let channel = (interaction.channel as Discord.TextChannel)
-    if (!channel.parent || config.tickets.category != channel.parent.id || (thread ? (threadChannel.parent.parent.id != config.tickets.category) : false)) {
+    if (!channel.parent || config.tickets.category !== channel.parent.id || (thread ? (threadChannel.parent.parent.id !== config.tickets.category) : false)) {
         return interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Deleting Ticket...")
             .setDescription("This ticket is not in your tickets category, so cannot be deleted. You cannot run close in a thread.")
@@ -19,7 +19,7 @@
         ], ephemeral: true});
     }
     let status = channel.topic.split(" ")[1];
-    if (status == "Archived") {
+    if (status === "Archived") {
         await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Delete Ticket")
             .setDescription("Your ticket is being deleted...")
@@ -47,7 +47,7 @@
         log(data);
         interaction.channel.delete();
         return;
-    } else if (status == "Active") {
+    } else if (status === "Active") {
         await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Close Ticket")
             .setDescription("Your ticket is being closed...")
@@ -66,7 +66,7 @@
                 type: "role"
             }
         ] as Discord.OverwriteResolvable[];
-        if (config.tickets.supportRole != null) {
+        if (config.tickets.supportRole !== null) {
             overwrites.push({
                 id: interaction.guild.roles.cache.get(config.tickets.supportRole),
                 allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -127,8 +127,8 @@
     let ticketChannels = tickets.children;
     let deleted = 0
     ticketChannels.forEach(element => {
-        if (element.type != "GUILD_TEXT") return;
-        if (element.topic.split(" ")[0] == member) {
+        if (element.type !== "GUILD_TEXT") return;
+        if (element.topic.split(" ")[0] === member) {
             try { element.delete(); } catch {}
             deleted++
         }
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 2068b15..5da8693 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -104,7 +104,7 @@
             if (dmd) await dm.delete()
             return
         }
-        let failed = (dmd == false && notify)
+        let failed = (dmd === false && notify)
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
             .setTitle(`Ban`)
@@ -125,20 +125,20 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     let memberPos = member.roles ? member.roles.highest.position : 0
     let mePos = me.roles ? me.roles.highest.position : 0
     let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Check if Nucleus can ban the member
     if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
     // Check if Nucleus has permission to ban
-    if (! me.permissions.has("BAN_MEMBERS")) throw "I do not have the Ban members permission";
+    if (! me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
     // Do not allow banning Nucleus
-    if (member.id == interaction.guild.me.id) throw "I cannot ban myself"
+    if (member.id === interaction.guild.me.id) throw "I cannot ban myself"
     // Allow the owner to ban anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has ban_members permission
-    if (! member.permissions.has("BAN_MEMBERS")) throw "You do not have the Ban members permission";
+    if (! member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
     // Check if the user is below on the role list
     if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow ban
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 0ea93d8..c50c6f4 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -143,7 +143,7 @@
         let end = "\n\nJanuary " + currentYear.toString() + pageIndicator(
             Math.max(groups.length, 1),
             groups.length === 0 ? 1 : pageIndex
-        ) + (currentYear == new Date().getFullYear() ? monthNames[new Date().getMonth()] : "December"
+        ) + (currentYear === new Date().getFullYear() ? monthNames[new Date().getMonth()] : "December"
         ) + " " + currentYear.toString()
         if (groups.length > 0) {
             let toRender = groups[Math.min(pageIndex, groups.length - 1)]
@@ -204,8 +204,8 @@
     let member = (interaction.options.getMember("user")) as Discord.GuildMember;
     await interaction.reply({embeds: [new EmojiEmbed()
         .setEmoji("NUCLEUS.LOADING")
-        .setTitle("Downloading data...")
-        .setStatus("Success")
+        .setTitle("Downloading Data")
+        .setStatus("Danger")
     ], ephemeral: true, fetchReply: true});
     let note;
     let firstLoad = true;
@@ -260,7 +260,7 @@
             });
             let out;
             try {
-                out = await modalInteractionCollector(m, (m) => m.channel.id == interaction.channel.id, (m) => m.customId == "modify")
+                out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "modify")
             } catch (e) { continue }
             if (out.fields) {
                 let toAdd = out.fields.getTextInputValue("note") || null;
@@ -275,7 +275,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as GuildMember)
-    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the Moderate members permission";
+    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     return true
 }
 
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index eac7ca3..a0b9a97 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -103,7 +103,7 @@
             if (dmd) await dm.delete()
             return
         }
-        let failed = (dmd == false && notify)
+        let failed = (dmd === false && notify)
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji(`PUNISH.KICK.${failed ? "YELLOW" : "GREEN"}`)
             .setTitle(`Kick`)
@@ -124,20 +124,20 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     let memberPos = member.roles ? member.roles.highest.position : 0
     let mePos = me.roles ? me.roles.highest.position : 0
     let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Check if Nucleus can kick the member
     if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
     // Check if Nucleus has permission to kick
-    if (! me.permissions.has("KICK_MEMBERS")) throw "I do not have the Kick members permission";
+    if (! me.permissions.has("KICK_MEMBERS")) throw "I do not have the *Kick Members* permission";
     // Do not allow kicking Nucleus
-    if (member.id == interaction.guild.me.id) throw "I cannot kick myself"
+    if (member.id === interaction.guild.me.id) throw "I cannot kick myself"
     // Allow the owner to kick anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has kick_members permission
-    if (! member.permissions.has("KICK_MEMBERS")) throw "You do not have the Kick members permission";
+    if (! member.permissions.has("KICK_MEMBERS")) throw "You do not have the *Kick Members* permission";
     // Check if the user is below on the role list
     if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow kick
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index f98bd6a..8bb6854 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
@@ -33,7 +34,7 @@
     if (config.moderation.mute.role) serverSettingsDescription += (serverSettingsDescription ? " and " : "") + `given the <@&${config.moderation.mute.role}> role`
 
     let muteTime = (time.days * 24 * 60 * 60) + (time.hours * 60 * 60) + (time.minutes * 60) + time.seconds
-    if (muteTime == 0) {
+    if (muteTime === 0) {
         let m = await interaction.reply({embeds: [
             new EmojiEmbed()
                 .setEmoji("PUNISH.MUTE.GREEN")
@@ -90,7 +91,7 @@
             component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
         } catch { return }
         component.deferUpdate();
-        if (component.customId == "cancel") return interaction.editReply({embeds: [new EmojiEmbed()
+        if (component.customId === "cancel") return interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji("PUNISH.MUTE.RED")
             .setTitle("Mute")
             .setDescription("Mute cancelled")
@@ -107,13 +108,7 @@
             case "1w": { muteTime = 60 * 60 * 24 * 7; break; }
         }
     } else {
-        await interaction.reply({embeds: [
-            new EmojiEmbed()
-                .setEmoji("PUNISH.MUTE.GREEN")
-                .setTitle("Mute")
-                .setDescription("Loading...")
-                .setStatus("Success")
-        ], ephemeral: true, fetchReply: true})
+        await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true})
     }
     // TODO:[Modals] Replace this with a modal
     let reason = null;
@@ -199,7 +194,7 @@
                 })
             }
         } catch (e){ console.log(e); errors++ }
-        if (errors == 2) {
+        if (errors === 2) {
             await interaction.editReply({embeds: [new EmojiEmbed()
                 .setEmoji("PUNISH.MUTE.RED")
                 .setTitle(`Mute`)
@@ -210,7 +205,7 @@
             return
         }
         try { await client.database.history.create("mute", interaction.guild.id, member.user, interaction.user, reason) } catch {}
-        let failed = (dmd == false && notify)
+        let failed = (dmd === false && notify)
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
             .setTitle(`Mute`)
@@ -253,22 +248,22 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     let memberPos = member.roles ? member.roles.highest.position : 0
     let mePos = me.roles ? me.roles.highest.position : 0
     let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Check if Nucleus can mute the member
     if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
     // Check if Nucleus has permission to mute
-    if (! me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the Moderate members permission";
+    if (! me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the *Moderate Members* permission";
     // Do not allow the user to have admin or be the owner
-    if (apply.permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
+    if (apply.permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id === interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
     // Do not allow muting Nucleus
-    if (member.id == me.id) throw "I cannot mute myself"
+    if (member.id === me.id) throw "I cannot mute myself"
     // Allow the owner to mute anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has moderate_members permission
-    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the Moderate members permission";
+    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     // Check if the user is below on the role list
     if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow mute
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 3ff18ec..cf33109 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -96,7 +96,7 @@
             if (dmd) await dm.delete()
             return
         }
-        let failed = (dmd == false && notify)
+        let failed = (dmd === false && notify)
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji(`PUNISH.NICKNAME.${failed ? "YELLOW" : "GREEN"}`)
             .setTitle(`Nickname`)
@@ -117,20 +117,20 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     let memberPos = member.roles ? member.roles.highest.position : 0
     let mePos = me.roles ? me.roles.highest.position : 0
     let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Check if Nucleus can change the nickname
     if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
     // Check if Nucleus has permission to change the nickname
-    if (! me.permissions.has("MANAGE_NICKNAMES")) throw "I do not have the Manage nicknames permission";
+    if (! me.permissions.has("MANAGE_NICKNAMES")) throw "I do not have the *Manage Nicknames* permission";
     // Allow the owner to change anyone's nickname
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has manage_nicknames permission
-    if (! member.permissions.has("MANAGE_NICKNAMES")) throw "You do not have the Manage nicknames permission";
+    if (! member.permissions.has("MANAGE_NICKNAMES")) throw "You do not have the *Manage Nicknames* permission";
     // Allow changing your own nickname
-    if (member == apply) return true
+    if (member === apply) return true
     // Check if the user is below on the role list
     if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow change
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index af7beb3..e1e4de9 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -314,11 +314,11 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     // Allow the owner to purge
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has manage_messages permission
-    if (! member.permissions.has("MANAGE_MESSAGES")) throw "You do not have the Manage messages permission";
+    if (! member.permissions.has("MANAGE_MESSAGES")) throw "You do not have the *Manage Messages* permission";
     // Check if nucleus has the manage_messages permission
-    if (! me.permissions.has("MANAGE_MESSAGES")) throw "I do not have the Manage messages permission";
+    if (! me.permissions.has("MANAGE_MESSAGES")) throw "I do not have the *Manage Messages* permission";
     // Allow warn
     return true
 }
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 2b386fd..6b33e12 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -62,9 +62,9 @@
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as GuildMember)
     // Check if Nucleus can set the slowmode
-    if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the Manage channels permission";
+    if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the *Manage Channels* permission";
     // Check if the user has manage_channel permission
-    if (! member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the Manage channels permission";
+    if (! member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the *Manage Channels* permission";
     // Allow slowmode
     return true
 }
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index 7fefb1b..5c7e8c4 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -81,7 +81,7 @@
             ], components: []})
         }
         try { await client.database.history.create("softban", interaction.guild.id, member.user, reason) } catch {}
-        let failed = (dmd == false && notify)
+        let failed = (dmd === false && notify)
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
             .setTitle(`Softban`)
@@ -102,20 +102,20 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     let memberPos = member.roles ? member.roles.highest.position : 0
     let mePos = me.roles ? me.roles.highest.position : 0
     let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Check if Nucleus can ban the member
     if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
     // Check if Nucleus has permission to ban
-    if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the Ban members permission";
+    if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
     // Do not allow softbanning Nucleus
-    if (member.id == me.id) throw "I cannot softban myself"
+    if (member.id === me.id) throw "I cannot softban myself"
     // Allow the owner to ban anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has ban_members permission
-    if (! member.permissions.has("BAN_MEMBERS")) throw "You do not have the Ban members permission";
+    if (! member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
     // Check if the user is below on the role list
     if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow softban
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 035b809..2605d28 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -15,9 +15,9 @@
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let bans = await interaction.guild.bans.fetch()
     let user = interaction.options.getString("user")
-    let resolved = bans.find(ban => ban.user.id == user)
-    if (!resolved) resolved = bans.find(ban => ban.user.username.toLowerCase() == user.toLowerCase())
-    if (!resolved) resolved = bans.find(ban => ban.user.tag.toLowerCase() == user.toLowerCase())
+    let resolved = bans.find(ban => ban.user.id === user)
+    if (!resolved) resolved = bans.find(ban => ban.user.username.toLowerCase() === user.toLowerCase())
+    if (!resolved) resolved = bans.find(ban => ban.user.tag.toLowerCase() === user.toLowerCase())
     if (!resolved) {
         return interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Unban")
@@ -92,11 +92,11 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     // Check if Nucleus can unban members
-    if (! me.permissions.has("BAN_MEMBERS")) throw "I do not have the Ban members permission";
+    if (! me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
     // Allow the owner to unban anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has ban_members permission
-    if (! member.permissions.has("BAN_MEMBERS")) throw "You do not have the Ban members permission";
+    if (! member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
     // Allow unban
     return true
 }
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index 56a0b56..25aacfa 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -89,7 +89,7 @@
             }
         }
         log(data);
-        let failed = (dmd == false && notify)
+        let failed = (dmd === false && notify)
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
             .setTitle(`Unmute`)
@@ -110,20 +110,20 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     let memberPos = member.roles ? member.roles.highest.position : 0
     let mePos = me.roles ? me.roles.highest.position : 0
     let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Check if Nucleus can unmute the member
     if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
     // Check if Nucleus has permission to unmute
-    if (! me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the Moderate members permission";
+    if (! me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the *Moderate Members* permission";
     // Do not allow the user to have admin or be the owner
-    if (apply.permissions.has("ADMINISTRATOR") || apply.id == interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
+    if (apply.permissions.has("ADMINISTRATOR") || apply.id === interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
     // Allow the owner to unmute anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has moderate_members permission
-    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the Moderate members permission";
+    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     // Check if the user is below on the role list
     if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow unmute
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index 684fc3a..2f5cacc 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -51,7 +51,7 @@
                 `**${channels[page][0].parent ? channels[page][0].parent.name  : "Uncategorised"}**` + "\n" +
                 channels[page].map(c => {
                     let channelType = c.type
-                    if (interaction.guild.rulesChannelId == c.id) channelType = "RULES"
+                    if (interaction.guild.rulesChannelId === c.id) channelType = "RULES"
                     else if ("nsfw" in c && c.nsfw) channelType += "_NSFW"
                     return c.permissionsFor(member).has("VIEW_CHANNEL") ? (
                         `${getEmojiByName("ICONS.CHANNEL." + channelType)} ${c.name}\n` + (() => {
@@ -98,7 +98,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as GuildMember)
-    if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the Manage roles permission";
+    if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
     return true
 }
 
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 3e76321..5a42911 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -98,7 +98,7 @@
             interaction.user, reason
         )} catch {}
         log(data);
-        let failed = (dmd == false && notify)
+        let failed = (dmd === false && notify)
         if (!failed) {
             await interaction.editReply({embeds: [new EmojiEmbed()
                 .setEmoji(`PUNISH.WARN.GREEN`)
@@ -138,7 +138,7 @@
                     .setStatus("Success")
                 ], components: []})
             }
-            if ( component.customId == "here" ) {
+            if ( component.customId === "here" ) {
                 await interaction.channel.send({
                     embeds: [new EmojiEmbed()
                         .setEmoji(`PUNISH.WARN.RED`)
@@ -179,16 +179,16 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     let memberPos = member.roles ? member.roles.highest.position : 0
     let mePos = me.roles ? me.roles.highest.position : 0
     let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Do not allow warning bots
     if (member.user.bot) throw "I cannot warn bots"
     // Allow the owner to warn anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has moderate_members permission
-    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the Moderate members permission";
+    if (! member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     // Check if the user is below on the role list
     if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow warn
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index f10dcae..6353843 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import { CommandInteraction } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -13,12 +14,7 @@
     // WEBSOCKET | Nucleus -> Discord
     // EDITING   | Nucleus -> discord -> nucleus | edit time / 2
     let initial = new Date().getTime();
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Ping")
-        .setDescription(`Checking ping times...`)
-        .setEmoji("NUCLEUS.LOADING")
-        .setStatus("Danger")
-    ], ephemeral: true});
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
     let ping = new Date().getTime() - initial;
     interaction.editReply({embeds: [new EmojiEmbed()
         .setTitle("Ping")
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 6d62745..81d1503 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,35 +1,169 @@
+import { LoadingEmbed } from './../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
-import { SlashCommandBuilder } from "@discordjs/builders";
+import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
 import { testLink, testMalware, testNSFW } from "../reflex/scanners.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
+import getEmojiByName from "../utils/getEmojiByName.js";
+import createPageIndicator from "../utils/createPageIndicator.js";
+import client from "../utils/client.js";
+import confirmationMessage from "../utils/confirmationMessage.js";
 
 const command = new SlashCommandBuilder()
     .setName("privacy")
     .setDescription("Information and options for you and your server's settings")
 
+class Embed {
+    embed: Discord.MessageEmbed;
+    title: string;
+    description: string = "";
+    pageId: number = 0;
+    components?: MessageActionRow[] = [];
+    setEmbed(embed: Discord.MessageEmbed) { this.embed = embed; return this; }
+    setTitle(title: string) { this.title = title; return this; }
+    setDescription(description: string) { this.description = description; return this; }
+    setPageId(pageId: number) { this.pageId = pageId; return this; }
+    setComponents(components: MessageActionRow[]) { this.components = components; return this; }
+}
+
 const callback = async (interaction: CommandInteraction): Promise<any> => {
-    let components = [];
-    if (interaction.inCachedGuild() && interaction.member.permissions.has("MANAGE_GUILD")) {
-        components.push(new MessageActionRow().addComponents([new MessageButton()
-            .setLabel("Clear all data")
-            .setEmoji("CONTROL.CROSS")
-            .setCustomId("clear")
-            .setStyle("DANGER")
-        ]));
+    let pages = [
+        new Embed()
+            .setEmbed(new EmojiEmbed()
+                .setTitle("Nucleus Privacy")
+                .setDescription(
+                    "Nucleus is a bot that naturally needs to store data about servers.\n" +
+                    "We are entirely [open source](https://github.com/ClicksMinutePer/Nucleus), so you can check exactly what we store, and how it works.\n\n" +
+                    "If you are a server administrator, you can view the options page in the dropdown under this message.\n\n" +
+                    "Any questions about Nucleus, how it works and data stored can be asked in [our server](https://discord.gg/bPaNnxe)."
+                )
+                .setEmoji("NUCLEUS.LOGO")
+                .setStatus("Danger")
+            ).setTitle("Welcome").setDescription("General privacy information").setPageId(0),
+        new Embed()
+            .setEmbed(new EmojiEmbed()
+                .setTitle("Scanners")
+                .setDescription(
+                    "Nucleus uses [unscan](https://unscan.co) to scan links, images and files for malware and other threats.\n" +
+                    "This service's [privacy policy](https://unscan.co/policies) is public, and they \"do not store or sell your data.\""
+                )
+                .setEmoji("NUCLEUS.LOGO")
+                .setStatus("Danger")
+            ).setTitle("Scanners").setDescription("About Unscan").setPageId(1),
+        new Embed()
+            .setEmbed(new EmojiEmbed()
+                .setTitle("Link scanning and Transcripts")
+                .setDescription(
+                    "**Facebook** - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
+                    "**AMP** - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
+                    "Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
+                )
+                .setEmoji("NUCLEUS.LOGO")
+                .setStatus("Danger")
+            ).setTitle("Link scanning and Transcripts").setDescription("Regarding Facebook and AMP filter types, and ticket transcripts").setPageId(2)
+    ].concat((interaction.member as Discord.GuildMember).permissions.has("ADMINISTRATOR") ? [new Embed()
+        .setEmbed(new EmojiEmbed()
+            .setTitle("Options")
+            .setDescription(
+                "Below are buttons for controlling this servers privacy settings"
+            )
+            .setEmoji("NUCLEUS.LOGO")
+            .setStatus("Danger")
+        ).setTitle("Options").setDescription("Options").setPageId(3).setComponents([new MessageActionRow().addComponents([
+            new MessageButton().setLabel("Clear all data").setCustomId("clear-all-data").setStyle("DANGER")
+        ])])
+    ] : []);
+    let m;
+    m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+    let page = 0;
+
+    let selectPaneOpen = false;
+    let nextFooter = null;
+
+    while (true) {
+        let selectPane = []
+
+        if (selectPaneOpen) {
+            let options = [];
+            pages.forEach(embed => {
+                options.push(new SelectMenuOption({
+                    label: embed.title,
+                    value: embed.pageId.toString(),
+                    description: embed.description || "",
+                }))
+            })
+            selectPane = [new MessageActionRow().addComponents([
+                new Discord.MessageSelectMenu()
+                    .addOptions(options)
+                    .setCustomId("page")
+                    .setMaxValues(1)
+                    .setPlaceholder("Choose a page...")
+            ])]
+        }
+        let components = selectPane.concat([new MessageActionRow().addComponents([
+            new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(page === 0),
+            new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(false),
+            new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1)
+        ])])
+        let em = new Discord.MessageEmbed(pages[page].embed)
+        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
+        em.setFooter({text: nextFooter ?? ""})
+        await interaction.editReply({
+            embeds: [em],
+            components: components.concat(pages[page].components)
+        });
+        let i
+        try {
+            i = await m.awaitMessageComponent({time: 300000});
+        } catch(e) { break }
+        nextFooter = null
+        i.deferUpdate()
+        if (i.component.customId === "left") {
+            if (page > 0) page--;
+            selectPaneOpen = false;
+        } else if (i.component.customId === "right") {
+            if (page < pages.length - 1) page++;
+            selectPaneOpen = false;
+        } else if (i.component.customId === "select") {
+            selectPaneOpen = !selectPaneOpen;
+        } else if (i.component.customId === "page") {
+            page = parseInt(i.values[0]);
+            selectPaneOpen = false;
+        } else if (i.component.customId === "clear-all-data") {
+            let confirmation = await new confirmationMessage(interaction)
+                .setEmoji("CONTROL.BLOCKCROSS")
+                .setTitle("Clear All Data")
+                .setDescription(
+                    `Are you sure you want to delete all data on this server? This includes your settings and all punishment histories.\n\n` +
+                    "**This cannot be undone.**"
+                )
+                .setColor("Danger")
+            .send(true)
+            if (confirmation.cancelled) { break; }
+            if (confirmation.success) {
+                client.database.guilds.delete(interaction.guild.id);
+                client.database.history.delete(interaction.guild.id);
+                nextFooter = "All data cleared";
+                continue;
+            } else {
+                nextFooter = "No changes were made";
+                continue;
+            }
+        } else {
+            let em = new Discord.MessageEmbed(pages[page].embed)
+            em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page))
+            em.setFooter({text: "Message closed"});
+            interaction.editReply({embeds: [em], components: []});
+            return
+        }
     }
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Privacy")
-        .setDescription(
-            "**Link Scanning Types**\n" +
-            "> Facebook - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
-            "> AMP - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
-            "**Transcripts**\n" +
-            "> Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
-        )
-        .setStatus("Success")
-        .setEmoji("NUCLEUS.COMMANDS.LOCK")
-    ], components: components});
+    let em = new Discord.MessageEmbed(pages[page].embed)
+    em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page))
+    em.setFooter({text: "Message timed out"});
+    await interaction.editReply({
+        embeds: [em],
+        components: []
+    });
 }
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index c431d39..274dd3d 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -28,7 +28,7 @@
         .setDescription(keyValueList({
             "user": renderUser(interaction.options.getUser("user")),
             "role": renderRole(interaction.options.getRole("role"))
-        }) + `\nAre you sure you want to ${action == "give" ? "give the role to" : "remove the role from"} ${interaction.options.getUser("user")}?`)
+        }) + `\nAre you sure you want to ${action === "give" ? "give the role to" : "remove the role from"} ${interaction.options.getUser("user")}?`)
         .setColor("Danger")
     .send()
     if (confirmation.cancelled) return
@@ -36,7 +36,7 @@
         try {
             let member = interaction.options.getMember("user") as GuildMember
             let role = interaction.options.getRole("role") as Role
-            if (interaction.options.getString("action") == "give") {
+            if (interaction.options.getString("action") === "give") {
                 member.roles.add(role)
             } else {
                 member.roles.remove(role)
@@ -51,7 +51,7 @@
         }
         return await interaction.editReply({embeds: [new EmojiEmbed()
             .setTitle("Role")
-            .setDescription(`The role has been ${action == "give" ? "given" : "removed"} successfully`)
+            .setDescription(`The role has been ${action === "give" ? "given" : "removed"} successfully`)
             .setStatus("Success")
             .setEmoji("GUILD.ROLES.CREATE")
         ], components: []})
@@ -69,13 +69,13 @@
     let member = (interaction.member as GuildMember)
     let me = (interaction.guild.me as GuildMember)
     let apply = (interaction.options.getMember("user") as GuildMember)
-    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    if (member === null || me === null || apply === null) throw "That member is not in the server"
     // Check if Nucleus has permission to role
-    if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the Manage roles permission";
+    if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
     // Allow the owner to role anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user has manage_roles permission
-    if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the Manage roles permission";
+    if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
     // Allow role
     return true;
 }
diff --git a/src/commands/server/about.ts b/src/commands/server/about.ts
index 28e09aa..70998d5 100644
--- a/src/commands/server/about.ts
+++ b/src/commands/server/about.ts
@@ -31,7 +31,7 @@
                 "2 factor authentication": `${guild.mfaLevel === "NONE" ? `${getEmojiByName("CONTROL.CROSS")} No` : `${getEmojiByName("CONTROL.TICK")} Yes`}`,
                 "verification level": `${toCapitals(guild.verificationLevel)}`,
                 "explicit content filter": `${toCapitals(guild.explicitContentFilter.toString().replace(/_/, " ", ))}`,
-                "nitro boost level": `${guild.premiumTier != "NONE" ? guild.premiumTier.toString()[-1] : "0"}`,
+                "nitro boost level": `${guild.premiumTier !== "NONE" ? guild.premiumTier.toString()[-1] : "0"}`,
                 "channels": `${guild.channels.cache.size}`,
                 "roles": `${guild.roles.cache.size}`,
                 "members": `${guild.memberCount}`,
diff --git a/src/commands/settings/commands.ts b/src/commands/settings/commands.ts
index df2cdb4..23d5c66 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -15,11 +16,7 @@
     .addRoleOption(o => o.setName("role").setDescription("The role given when a member is muted"))
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true});
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
     let m;
     let clicked = "";
     if (interaction.options.getRole("role")) {
@@ -49,7 +46,7 @@
             .setEmoji("PUNISH.BAN.GREEN")
             .setStatus("Success")
             .setDescription(
-                "These links are shown below the message sent in a user's DM when they are warned, banned, etc.\n\n" +
+                "These links are shown below the message sent in a user's DM when they are punished.\n\n" +
                 `**Mute Role:** ` + (moderation.mute.role ? `<@&${moderation.mute.role}>` : "*None set*")
             )
         ], components: [new MessageActionRow().addComponents([
@@ -76,13 +73,16 @@
         } catch (e) { return }
         let chosen = moderation[i.customId] ?? {text: null, url: null};
         if (i.component.customId === "clearMuteRole") {
+            i.deferUpdate()
             if (clicked === "clearMuteRole") {
-                await client.database.guilds.write(interaction.guild.id, { moderation: { mute: { role: null } } });
+                await client.database.guilds.write(interaction.guild.id, {"moderation.mute.role": null });
             } else { clicked = "clearMuteRole" }
+            continue
         } else { clicked = "" }
         if (i.component.customId === "timeout") {
             await i.deferUpdate()
-            await client.database.guilds.write(interaction.guild.id, { moderation: { mute: { timeout: !moderation.mute.timeout } } });
+            await client.database.guilds.write(interaction.guild.id, {"moderation.mute.timeout": !moderation.mute.timeout } );
+            continue
         } else if (i.customId) {
             await i.showModal(new Discord.Modal().setCustomId("modal").setTitle(`Options for ${i.customId}`).addComponents(
                 new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
@@ -117,7 +117,7 @@
             });
             let out;
             try {
-                out = await modalInteractionCollector(m, (m) => m.channel.id == interaction.channel.id, (m) => true)
+                out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => true)
             } catch (e) { continue }
             if (out.fields) {
                 let buttonText = out.fields.getTextInputValue("name");
@@ -125,7 +125,7 @@
                 let current = chosen;
                 if (current.text !== buttonText || current.link !== buttonLink) {
                     chosen = { text: buttonText, link: buttonLink };
-                    await client.database.guilds.write(interaction.guild.id, { ["moderation" + i.customId]: { text: buttonText, link: buttonLink }});
+                    await client.database.guilds.write(interaction.guild.id, { ["moderation." + i.customId]: { text: buttonText, link: buttonLink }});
                 }
             } else { continue }
         }
@@ -135,7 +135,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage server permission to use this command"
+    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index 0842923..2dae74e 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../../utils/defaultEmbeds.js';
 import { ChannelType } from 'discord-api-types';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -17,11 +18,7 @@
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let m;
-    m = await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true});
+    m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
     if (interaction.options.getChannel("channel")) {
         let channel
         try {
@@ -35,7 +32,7 @@
             ]})
         }
         channel = channel as Discord.TextChannel
-        if (channel.guild.id != interaction.guild.id) {
+        if (channel.guild.id !== interaction.guild.id) {
             return interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Attachment Log Channel")
                 .setDescription(`You must choose a channel in this server`)
@@ -120,11 +117,11 @@
             i = await m.awaitMessageComponent({time: 300000});
         } catch(e) { break }
         i.deferUpdate()
-        if (i.component.customId == "clear") {
+        if (i.component.customId === "clear") {
             clicks += 1;
-            if (clicks == 2) {
+            if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, {}, ["logging.announcements.channel"])
+                await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"])
                 channel = undefined;
             }
         } else {
@@ -148,7 +145,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index aacc2e7..4030108 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../../utils/defaultEmbeds.js';
 import { ChannelType } from 'discord-api-types';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -17,11 +18,7 @@
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let m;
-    m = await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true});
+    m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
     if (interaction.options.getChannel("channel")) {
         let channel
         try {
@@ -35,7 +32,7 @@
             ]})
         }
         channel = channel as Discord.TextChannel
-        if (channel.guild.id != interaction.guild.id) {
+        if (channel.guild.id !== interaction.guild.id) {
             return interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Log Channel")
                 .setDescription(`You must choose a channel in this server`)
@@ -115,11 +112,11 @@
             i = await m.awaitMessageComponent({time: 300000});
         } catch(e) { break }
         i.deferUpdate()
-        if (i.component.customId == "clear") {
+        if (i.component.customId === "clear") {
             clicks += 1;
-            if (clicks == 2) {
+            if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, {}, ["logging.logs.channel"])
+                await client.database.guilds.write(interaction.guild.id, null, ["logging.logs.channel"])
                 channel = undefined;
             }
         } else {
@@ -143,7 +140,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index 3cb7230..5867338 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../../utils/defaultEmbeds.js';
 import { ChannelType } from 'discord-api-types';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -17,11 +18,7 @@
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let m;
-    m = await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true});
+    m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
     if (interaction.options.getChannel("channel")) {
         let channel
         try {
@@ -35,7 +32,7 @@
             ]})
         }
         channel = channel as Discord.TextChannel
-        if (channel.guild.id != interaction.guild.id) {
+        if (channel.guild.id !== interaction.guild.id) {
             return interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Staff Notifications Channel")
                 .setDescription(`You must choose a channel in this server`)
@@ -117,11 +114,11 @@
             i = await m.awaitMessageComponent({time: 300000});
         } catch(e) { break }
         i.deferUpdate()
-        if (i.component.customId == "clear") {
+        if (i.component.customId === "clear") {
             clicks += 1;
-            if (clicks == 2) {
+            if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, {}, ["logging.staff.channel"])
+                await client.database.guilds.write(interaction.guild.id, null, ["logging.staff.channel"])
                 channel = undefined;
             }
         } else {
@@ -145,7 +142,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index ec54820..6f95b46 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -17,7 +17,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_ROLES")) throw "You must have the Manage roles permission to use this command"
+    if (!member.permissions.has("MANAGE_ROLES")) throw "You must have the *Manage Roles* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index 3159e2d..d972674 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import { ChannelType } from 'discord-api-types';
 import Discord, { AutocompleteInteraction, CommandInteraction, Message, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -8,6 +9,7 @@
 import client from "../../utils/client.js";
 import convertCurlyBracketString from '../../utils/convertCurlyBracketString.js';
 import {callback as statsChannelAddCallback} from "../../reflex/statsChannelUpdate.js";
+import singleNotify from '../../utils/singleNotify.js';
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
@@ -17,14 +19,20 @@
     .addStringOption(option => option.setName("name").setDescription("The new channel name | Enter any text or use the extra variables like {memberCount}").setAutocomplete(true))
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
+    singleNotify("statsChannelDeleted", interaction.guild.id, true)
     let m;
-    m = await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true});
+    m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+    let config = await client.database.guilds.read(interaction.guild.id);
     if (interaction.options.getString("name")) {
-        let channel
+        let channel;
+        if (Object.keys(config.getKey("stats")).length >= 25) {
+            return await interaction.editReply({embeds: [new EmojiEmbed()
+                .setEmoji("CHANNEL.TEXT.DELETE")
+                .setTitle("Stats Channel")
+                .setDescription("You can only have 25 stats channels in a server")
+                .setStatus("Danger")
+            ]})
+        }
         try {
             channel = interaction.options.getChannel("channel")
         } catch {
@@ -36,7 +44,7 @@
             ]})
         }
         channel = channel as Discord.TextChannel
-        if (channel.guild.id != interaction.guild.id) {
+        if (channel.guild.id !== interaction.guild.id) {
             return interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Stats Channel")
                 .setDescription(`You must choose a channel in this server`)
@@ -51,7 +59,7 @@
         let confirmation = await new confirmationMessage(interaction)
             .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Stats Channel")
-            .setDescription(`Are you sure you want to set <#${channel.id}> to a stats channel?\n\n*Preview: ${newName}*`)
+            .setDescription(`Are you sure you want to set <#${channel.id}> to a stats channel?\n\n*Preview: ${newName.replace(/^ +| $/g, "")}*`)
             .setColor("Warning")
             .setInverted(true)
         .send(true)
@@ -104,7 +112,7 @@
         await statsChannelAddCallback(client, interaction.member);
     }
     while (true) {
-        let config = await client.database.guilds.read(interaction.guild.id);
+        config = await client.database.guilds.read(interaction.guild.id);
         let stats = config.getKey("stats")
         let selectMenu = new MessageSelectMenu()
             .setCustomId("remove")
@@ -133,8 +141,7 @@
         i.deferUpdate()
         if (i.customId === "remove") {
             let toRemove = i.values;
-            console.log(toRemove.map(k => `stats.${k}`))
-            await client.database.guilds.write(interaction.guild.id, {}, toRemove.map(k => `stats.${k}`));
+            await client.database.guilds.write(interaction.guild.id, null, toRemove.map(k => `stats.${k}`));
         }
     }
     await interaction.editReply({embeds: [new EmojiEmbed()
@@ -147,7 +154,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 16d5f3b..f199ac3 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -21,13 +22,7 @@
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let m;
-    m = await interaction.reply({
-        embeds: [new EmojiEmbed()
-            .setTitle("Loading")
-            .setStatus("Danger")
-            .setEmoji("NUCLEUS.LOADING")
-        ], ephemeral: true, fetchReply: true
-    });
+    m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
     let options = {
         enabled: interaction.options.getString("enabled") as string | boolean,
         category: interaction.options.getChannel("category"),
@@ -51,7 +46,7 @@
                 })
             }
             channel = channel as Discord.CategoryChannel
-            if (channel.guild.id != interaction.guild.id) return interaction.editReply({
+            if (channel.guild.id !== interaction.guild.id) return interaction.editReply({
                 embeds: [new EmojiEmbed()
                     .setTitle("Tickets > Category")
                     .setDescription(`You must choose a category in this server`)
@@ -85,7 +80,7 @@
                 })
             }
             role = role as Discord.Role
-            if (role.guild.id != interaction.guild.id) return interaction.editReply({
+            if (role.guild.id !== interaction.guild.id) return interaction.editReply({
                 embeds: [new EmojiEmbed()
                     .setTitle("Tickets > Support Ping")
                     .setDescription(`You must choose a role in this server`)
@@ -174,23 +169,23 @@
                     .setStyle(data.enabled ? "SUCCESS" : "DANGER")
                     .setCustomId("enabled"),
                 new MessageButton()
-                    .setLabel(lastClicked == "cat" ? "Click again to confirm" : "Clear category")
+                    .setLabel(lastClicked === "cat" ? "Click again to confirm" : "Clear category")
                     .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                     .setStyle("DANGER")
                     .setCustomId("clearCategory")
-                    .setDisabled(data.category == null),
+                    .setDisabled(data.category === null),
                 new MessageButton()
-                    .setLabel(lastClicked == "max" ? "Click again to confirm" : "Reset max tickets")
+                    .setLabel(lastClicked === "max" ? "Click again to confirm" : "Reset max tickets")
                     .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                     .setStyle("DANGER")
                     .setCustomId("clearMaxTickets")
-                    .setDisabled(data.maxTickets == 5),
+                    .setDisabled(data.maxTickets === 5),
                 new MessageButton()
-                    .setLabel(lastClicked == "sup" ? "Click again to confirm" : "Clear support ping")
+                    .setLabel(lastClicked === "sup" ? "Click again to confirm" : "Clear support ping")
                     .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                     .setStyle("DANGER")
                     .setCustomId("clearSupportPing")
-                    .setDisabled(data.supportRole == null),
+                    .setDisabled(data.supportRole === null),
             ]), new MessageActionRow().addComponents([
                 new MessageButton()
                     .setLabel("Manage types")
@@ -204,28 +199,28 @@
             i = await m.awaitMessageComponent({ time: 300000 });
         } catch (e) { break }
         i.deferUpdate()
-        if (i.component.customId == "clearCategory") {
-            if (lastClicked == "cat") {
+        if (i.component.customId === "clearCategory") {
+            if (lastClicked === "cat") {
                 lastClicked = "";
-                await client.database.guilds.write(interaction.guild.id, {}, ["tickets.category"])
+                await client.database.guilds.write(interaction.guild.id, null, ["tickets.category"])
                 data.category = undefined;
             } else lastClicked = "cat";
-        } else if (i.component.customId == "clearMaxTickets") {
-            if (lastClicked == "max") {
+        } else if (i.component.customId === "clearMaxTickets") {
+            if (lastClicked === "max") {
                 lastClicked = "";
-                await client.database.guilds.write(interaction.guild.id, {}, ["tickets.maxTickets"])
+                await client.database.guilds.write(interaction.guild.id, null, ["tickets.maxTickets"])
                 data.maxTickets = 5;
             } else lastClicked = "max";
-        } else if (i.component.customId == "clearSupportPing") {
-            if (lastClicked == "sup") {
+        } else if (i.component.customId === "clearSupportPing") {
+            if (lastClicked === "sup") {
                 lastClicked = "";
-                await client.database.guilds.write(interaction.guild.id, {}, ["tickets.supportRole"])
+                await client.database.guilds.write(interaction.guild.id, null, ["tickets.supportRole"])
                 data.supportRole = undefined;
             } else lastClicked = "sup";
-        } else if (i.component.customId == "enabled") {
+        } else if (i.component.customId === "enabled") {
             await client.database.guilds.write(interaction.guild.id, { "tickets.enabled": !data.enabled })
             data.enabled = !data.enabled;
-        } else if (i.component.customId == "manageTypes") {
+        } else if (i.component.customId === "manageTypes") {
             data = await manageTypes(interaction, data, m);
         } else {
             break
@@ -329,12 +324,12 @@
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
         } catch (e) { break }
-        if (i.component.customId == "types") {
+        if (i.component.customId === "types") {
             i.deferUpdate()
             let types = toHexInteger(i.values, ticketTypes);
             await client.database.guilds.write(interaction.guild.id, { "tickets.types": types })
             data.types = types;
-        } else if (i.component.customId == "removeTypes") {
+        } else if (i.component.customId === "removeTypes") {
             i.deferUpdate()
             let types = i.values
             let customTypes = data.customTypes;
@@ -344,7 +339,7 @@
                 await client.database.guilds.write(interaction.guild.id, { "tickets.customTypes": customTypes })
                 data.customTypes = customTypes;
             }
-        } else if (i.component.customId == "addType") {
+        } else if (i.component.customId === "addType") {
             await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Enter a name for the new type").addComponents(
                 new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
                     .setCustomId("type")
@@ -371,7 +366,7 @@
             });
             let out;
             try {
-                out = await modalInteractionCollector(m, (m) => m.channel.id == interaction.channel.id, (m) => m.customId == "addType")
+                out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "addType")
             } catch (e) { continue }
             if (out.fields) {
                 let toAdd = out.fields.getTextInputValue("type");
@@ -385,11 +380,11 @@
                     data.customTypes.push(toAdd);
                 }
             } else { continue }
-        } else if (i.component.customId == "switchToDefault") {
+        } else if (i.component.customId === "switchToDefault") {
             i.deferUpdate()
             await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": false }, [])
             data.useCustom = false;
-        } else if (i.component.customId == "switchToCustom") {
+        } else if (i.component.customId === "switchToCustom") {
             i.deferUpdate()
             await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": true }, [])
             data.useCustom = true;
@@ -404,7 +399,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index d71fdf0..14dfe8d 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -14,11 +15,7 @@
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let m;
-    m = await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true});
+    m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
     if (interaction.options.getRole("role")) {
         let role
         try {
@@ -32,7 +29,7 @@
             ]})
         }
         role = role as Discord.Role
-        if (role.guild.id != interaction.guild.id) {
+        if (role.guild.id !== interaction.guild.id) {
             return interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Verify Role")
                 .setDescription(`You must choose a role in this server`)
@@ -100,23 +97,24 @@
             .setDescription(role ? `Your verify role is currently set to <@&${role}>` : `You have not set a verify role`)
             .setStatus("Success")
             .setEmoji("GUILD.ROLES.CREATE")
-        ], components: [new MessageActionRow().addComponents([new MessageButton()
-            .setCustomId("clear")
-            .setLabel(clicks ? "Click again to confirm" : "Reset role")
-            .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
-            .setStyle("DANGER")
-            .setDisabled(!role)
+        ], components: [new MessageActionRow().addComponents([
+            new MessageButton()
+                .setCustomId("clear")
+                .setLabel(clicks ? "Click again to confirm" : "Reset role")
+                .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
+                .setStyle("DANGER")
+                .setDisabled(!role)
         ])]});
         let i;
         try {
             i = await m.awaitMessageComponent({time: 300000});
         } catch(e) { break }
         i.deferUpdate()
-        if (i.component.customId == "clear") {
+        if (i.component.customId === "clear") {
             clicks += 1;
-            if (clicks == 2) {
+            if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, {}, ["verify.role", "verify.enabled"])
+                await client.database.guilds.write(interaction.guild.id, null, ["verify.role", "verify.enabled"])
                 role = undefined;
             }
         } else {
@@ -134,13 +132,13 @@
         .setLabel("Clear")
         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
         .setStyle("SECONDARY")
-        .setDisabled(true)
+        .setDisabled(true),
     ])]});
 }
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the Manage Server permission to use this command"
+    if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index 0c44e37..03b13c6 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -55,4 +55,4 @@
 export { command };
 export { callback };
 export { check };
-export { autocomplete };
\ No newline at end of file
+export { autocomplete };
diff --git a/src/commands/tags/create.ts b/src/commands/tags/create.ts
index 0e0d54d..b0a278d 100644
--- a/src/commands/tags/create.ts
+++ b/src/commands/tags/create.ts
@@ -79,7 +79,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the Manage Messages permission to use this command"
+    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Server* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/tags/delete.ts b/src/commands/tags/delete.ts
index f531e93..68a02d4 100644
--- a/src/commands/tags/delete.ts
+++ b/src/commands/tags/delete.ts
@@ -60,7 +60,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the Manage Messages permission to use this command"
+    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index 2ecdfbf..2f585cd 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -75,7 +75,7 @@
             toUnset.push(`tags.${name}`);
             toSet[`tags.${newname}`] = data.tags[name];
         }
-        await client.database.guilds.write(interaction.guild.id, toSet, toUnset);
+        await client.database.guilds.write(interaction.guild.id, toSet === {} ? null : toSet, toUnset);
     } catch (e) {
         return await interaction.editReply({embeds: [new EmojiEmbed()
             .setTitle("Tag Edit")
@@ -94,7 +94,7 @@
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
     let member = (interaction.member as Discord.GuildMember)
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the Manage Messages permission to use this command"
+    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command"
     return true;
 }
 
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index a534791..c335267 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
@@ -53,15 +54,7 @@
             ).setTitle(`Page ${pages.length + 1}`).setPageId(pages.length))
     }
     let m;
-    m = await interaction.reply({
-        embeds: [
-            new EmojiEmbed()
-                .setTitle("Welcome")
-                .setDescription(`One moment...`)
-                .setStatus("Danger")
-                .setEmoji("NUCLEUS.LOADING")
-        ], fetchReply: true, ephemeral: true
-    });
+    m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
     let page = 0;
     let selectPaneOpen = false;
     while (true) {
@@ -100,15 +93,15 @@
             i = await m.awaitMessageComponent({time: 300000 });
         } catch (e) { break }
         i.deferUpdate()
-        if (i.component.customId == "left") {
+        if (i.component.customId === "left") {
             if (page > 0) page--;
             selectPaneOpen = false;
-        } else if (i.component.customId == "right") {
+        } else if (i.component.customId === "right") {
             if (page < pages.length - 1) page++;
             selectPaneOpen = false;
-        } else if (i.component.customId == "select") {
+        } else if (i.component.customId === "select") {
             selectPaneOpen = !selectPaneOpen;
-        } else if (i.component.customId == "page") {
+        } else if (i.component.customId === "page") {
             page = parseInt(i.values[0]);
             selectPaneOpen = false;
         } else {
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 8557d15..82eda6a 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
@@ -64,7 +65,7 @@
     membersArray.sort((a, b) => a.joinedTimestamp - b.joinedTimestamp)
     let joinPos = membersArray.findIndex(m => m.id === member.user.id)
 
-    let roles = member.roles.cache.filter(r => r.id != interaction.guild.id).sort()
+    let roles = member.roles.cache.filter(r => r.id !== interaction.guild.id).sort()
     let s = "";
     let count = 0;
     let ended = false
@@ -158,7 +159,7 @@
             ).setTitle("Key Permissions").setDescription("Key permissions the user has").setPageId(2),
     ]
     let m
-    m = await interaction.reply({embeds: [new EmojiEmbed().setTitle("Loading").setEmoji("NUCLEUS.LOADING").setStatus("Danger")], fetchReply: true, ephemeral: true});
+    m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
     let page = 0
     let breakReason = ""
     while (true) {
@@ -212,18 +213,18 @@
             i = await m.awaitMessageComponent({time: 300000});
         } catch { breakReason = "Message timed out"; break }
         i.deferUpdate()
-        if (i.component.customId == "left") {
+        if (i.component.customId === "left") {
             if (page > 0) page--;
             selectPaneOpen = false;
-        } else if (i.component.customId == "right") {
+        } else if (i.component.customId === "right") {
             if (page < embeds.length - 1) page++;
             selectPaneOpen = false;
-        } else if (i.component.customId == "select") {
+        } else if (i.component.customId === "select") {
             selectPaneOpen = !selectPaneOpen;
-        } else if (i.component.customId == "close") {
+        } else if (i.component.customId === "close") {
             breakReason = "Message closed";
             break;
-        } else if (i.component.customId == "page") {
+        } else if (i.component.customId === "page") {
             page = parseInt(i.values[0]);
             selectPaneOpen = false;
         } else {
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 54af9d7..f6c1df1 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageButton } from "discord.js";
 import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
@@ -15,9 +16,9 @@
 const generateFromTrack = (position: number, active: any, size: number, disabled: any) => {
     active = active ? "ACTIVE" : "INACTIVE"
     disabled = disabled ? "GREY." : ""
-    if (position == 0 && size == 1) return "TRACKS.SINGLE." + disabled + active
-    if (position == size - 1) return "TRACKS.VERTICAL.BOTTOM." + disabled + active
-    if (position == 0) return "TRACKS.VERTICAL.TOP." + disabled + active
+    if (position === 0 && size === 1) return "TRACKS.SINGLE." + disabled + active
+    if (position === size - 1) return "TRACKS.VERTICAL.BOTTOM." + disabled + active
+    if (position === 0) return "TRACKS.VERTICAL.TOP." + disabled + active
     return "TRACKS.VERTICAL.MIDDLE." + disabled + active
 }
 
@@ -26,11 +27,7 @@
     const member = interaction.options.getMember("user") as GuildMember;
     const guild = interaction.guild;
     let config = await client.database.guilds.read(guild.id);
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setEmoji("NUCLEUS.LOADING")
-        .setTitle("Loading")
-        .setStatus("Danger")
-    ], ephemeral: true})
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true})
     let track = 0
     let generated;
     const roles = await guild.roles.fetch()
@@ -43,10 +40,10 @@
         let dropdown = new Discord.MessageSelectMenu().addOptions(config.tracks.map((option, index) => {
             let hasRoleInTrack = option.track.some(element => {return memberRoles.cache.has(element)})
             return new SelectMenuOption({
-                default: index == track,
+                default: index === track,
                 label: option.name,
                 value: index.toString(),
-                description: option.track.length == 0 ? "No" : addPlural(option.track.length, "role"),
+                description: option.track.length === 0 ? "No" : addPlural(option.track.length, "role"),
                 emoji: client.emojis.resolve(getEmojiByName("TRACKS.SINGLE." + (hasRoleInTrack ? "ACTIVE" : "INACTIVE"), "id"))
             })
         })).setCustomId("select").setMaxValues(1)
@@ -94,7 +91,7 @@
                 generated += "You don't have permission to manage one or more of the users roles, and therefore can't select one to keep."
             }
         } else {
-            currentRoleIndex = selected.length == 0 ? -1 : data.track.indexOf(selected[0].toString())
+            currentRoleIndex = selected.length === 0 ? -1 : data.track.indexOf(selected[0].toString())
         }
         let m = await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji("TRACKS.ICON")
@@ -112,7 +109,7 @@
                     .setLabel("Move up")
                     .setCustomId("promote")
                     .setStyle("SUCCESS")
-                    .setDisabled(conflict || currentRoleIndex == 0 || (currentRoleIndex == -1 ? false : !allowed[currentRoleIndex - 1])),
+                    .setDisabled(conflict || currentRoleIndex === 0 || (currentRoleIndex === -1 ? false : !allowed[currentRoleIndex - 1])),
                 new MessageButton()
                     .setEmoji(getEmojiByName("CONTROL.DOWN", "id"))
                     .setLabel("Move down")
@@ -120,7 +117,7 @@
                     .setStyle("DANGER")
                     .setDisabled(conflict || (
                         data.nullable ? currentRoleIndex <= -1 :
-                        currentRoleIndex == data.track.length - 1 || currentRoleIndex <= -1
+                        currentRoleIndex === data.track.length - 1 || currentRoleIndex <= -1
                     ) || !allowed[currentRoleIndex]),
             ])
         ])})
@@ -131,31 +128,31 @@
             return
         }
         component.deferUpdate()
-        if (component.customId == "conflict") {
-            let rolesToRemove = selected.filter(role => role != component.values[0])
+        if (component.customId === "conflict") {
+            let rolesToRemove = selected.filter(role => role !== component.values[0])
             await member.roles.remove(rolesToRemove)
-        } else if (component.customId == "promote") {
+        } else if (component.customId === "promote") {
             if (
-                currentRoleIndex == -1 ? allowed[data.track.length - 1] :
+                currentRoleIndex === -1 ? allowed[data.track.length - 1] :
                 allowed[currentRoleIndex - 1] && allowed[currentRoleIndex]
             ) {
-                if (currentRoleIndex == -1) {
+                if (currentRoleIndex === -1) {
                     await member.roles.add(data.track[data.track.length - 1])
                 } else if (currentRoleIndex < data.track.length) {
                     if (!data.retainPrevious) await member.roles.remove(data.track[currentRoleIndex])
                     await member.roles.add(data.track[currentRoleIndex - 1])
                 }
             }
-        } else if (component.customId == "demote") {
+        } else if (component.customId === "demote") {
             if(allowed[currentRoleIndex]) {
-                if (currentRoleIndex == data.track.length - 1) {
+                if (currentRoleIndex === data.track.length - 1) {
                     if (data.nullable) await member.roles.remove(data.track[currentRoleIndex])
                 } else if (currentRoleIndex > -1) {
                     await member.roles.remove(data.track[currentRoleIndex])
                     await member.roles.add(data.track[currentRoleIndex + 1])
                 }
             }
-        } else if (component.customId == "select") {
+        } else if (component.customId === "select") {
             track = component.values[0]
         }
     }
@@ -166,7 +163,7 @@
     if (tracks.length === 0) throw "This server does not have any tracks"
     let member = (interaction.member as GuildMember)
     // Allow the owner to promote anyone
-    if (member.id == interaction.guild.ownerId) return true
+    if (member.id === interaction.guild.ownerId) return true
     // Check if the user can manage any of the tracks
     let managed = false
     tracks.forEach(element => {
@@ -174,7 +171,7 @@
         if (element.track.manageableBy.some(role => member.roles.cache.has(role))) managed = true
     });
     // Check if the user has manage_roles permission
-    if (!managed && ! member.permissions.has("MANAGE_ROLES")) throw "You do not have the Manage roles permission";
+    if (!managed && ! member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
     // Allow track
     return true;
 }
diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index 2d48255..fa66755 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -4,8 +4,8 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = channel.client.logger
         let auditLog = await getAuditLog(channel.guild, 'CHANNEL_CREATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === channel.id).first();
+        if (audit.executor.id === client.user.id) return;
         let emoji;
         let readableType;
         let displayName;
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index ffe3eae..25c9ce5 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -7,8 +7,8 @@
         const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger
 
         let auditLog = await getAuditLog(channel.guild, 'CHANNEL_DELETE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === channel.id).first();
+        if (audit.executor.id === client.user.id) return;
 
         let emoji;
         let readableType;
@@ -49,7 +49,7 @@
             deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor))
         }
-        if (channel.topic != null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
+        if (channel.topic !== null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
         else delete list.topic;
         if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
         else delete list.nsfw;
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 50a3de1..568af0b 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -8,11 +8,11 @@
         let config = await client.memory.readGuildInfo(nc.guild.id);
         const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderChannel } = client.logger
 
-        if (nc.parent && (nc.parent.id == config.tickets.category)) return
+        if (nc.parent && (nc.parent.id === config.tickets.category)) return
 
         let auditLog = await getAuditLog(nc.guild, 'CHANNEL_UPDATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == nc.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === nc.id).first();
+        if (audit.executor.id === client.user.id) return;
 
         let emoji:string;
         let readableType:string;
@@ -23,8 +23,8 @@
             edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
             editedBy: entry(audit.executor.id, renderUser((await nc.guild.members.fetch(audit.executor.id)).user)),
         }
-        if (oc.name != nc.name) changes["name"] = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
-        if (oc.position != nc.position) changes["position"] = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
+        if (oc.name !== nc.name) changes["name"] = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
+        if (oc.position !== nc.position) changes["position"] = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
 
         switch (nc.type) {
             case 'GUILD_TEXT': {
@@ -43,9 +43,9 @@
                 let nsfw = ["", ""]
                 nsfw[0] = oc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
                 nsfw[1] = nc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
-                if (oc.topic != nc.topic) changes["description"] = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
-                if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
-                if (oc.rateLimitPerUser != nc.rateLimitPerUser) changes["rateLimitPerUser"] = entry(
+                if (oc.topic !== nc.topic) changes["description"] = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
+                if (oc.nsfw !== nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
+                if (oc.rateLimitPerUser !== nc.rateLimitPerUser) changes["rateLimitPerUser"] = entry(
                     [oc.rateLimitPerUser, nc.rateLimitPerUser],
                     `${humanizeDuration(oc.rateLimitPerUser * 1000)} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
                 );
@@ -65,16 +65,16 @@
                     if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
                     else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
                 } else { newTopic = "None"; }
-                if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
+                if (oc.nsfw !== nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
                 break;
             }
             case 'GUILD_VOICE': {
                 emoji = "CHANNEL.VOICE.EDIT";
                 readableType = "Voice";
                 displayName = "Voice Channel"
-                if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
-                if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
-                if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
+                if (oc.bitrate !== nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
+                if (oc.userLimit !== nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
+                if (oc.rtcRegion !== nc.rtcRegion) changes["region"] = entry(
                     [oc.rtcRegion, nc.rtcRegion],
                     `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
                 );
@@ -93,9 +93,9 @@
                     if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
                     else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
                 } else { newTopic = "None"; }
-                if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
-                if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
-                if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
+                if (oc.bitrate !== nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
+                if (oc.userLimit !== nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
+                if (oc.rtcRegion !== nc.rtcRegion) changes["region"] = entry(
                     [oc.rtcRegion, nc.rtcRegion],
                     `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
                 );
@@ -114,7 +114,7 @@
             }
         }
         let t = oc.type.split("_")[1];
-        if (oc.type != nc.type) changes["type"] = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
+        if (oc.type !== nc.type) changes["type"] = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
         if (!(Object.values(changes).length - 4)) return
         let data = {
             meta:{
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 25d1b62..9e91012 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -4,8 +4,8 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
         let auditLog = await getAuditLog(emoji.guild, 'EMOJI_CREATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'emojiCreate',
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index 2dcb685..0c39542 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -4,8 +4,8 @@
     try{
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
         let auditLog = await getAuditLog(emoji.guild, 'EMOJI_DELETE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'emojiDelete',
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index 79fb171..a90de9a 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -6,10 +6,10 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
 
-        if (oe.name == ne.name) return
+        if (oe.name === ne.name) return
         let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
         let audit = auditLog.entries.first();
-        if (audit.executor.id == client.user.id) return;
+        if (audit.executor.id === client.user.id) return;
 
         let changes = {
             emojiId: entry(ne.id, `\`${ne.id}\``),
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index d095049..06163a9 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -9,8 +9,8 @@
     try {
         const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger
         let auditLog = await getAuditLog(ban.guild, 'MEMBER_BAN_ADD')
-        let audit = auditLog.entries.filter(entry => entry.target.id == ban.user.id).first();
-        if (audit.executor.id == client.user.id) return
+        let audit = auditLog.entries.filter(entry => entry.target.id === ban.user.id).first();
+        if (audit.executor.id === client.user.id) return
         try { await client.database.history.create("ban", ban.guild.id, ban.user, audit.executor, audit.reason) } catch {}
         let data = {
             meta: {
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index 4d6d1f8..2a1b6de 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -10,8 +10,8 @@
     try {
         const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger
         let auditLog = await getAuditLog(ban.guild, 'MEMBER_BAN_REMOVE')
-        let audit = auditLog.entries.filter(entry => entry.target.id == ban.user.id).first();
-        if (audit.executor.id == client.user.id) return
+        let audit = auditLog.entries.filter(entry => entry.target.id === ban.user.id).first();
+        if (audit.executor.id === client.user.id) return
         try { await client.database.history.create("unban", ban.guild.id, ban.user, audit.executor, audit.reason) } catch {}
         let data = {
             meta: {
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index e68aee4..d555647 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -4,9 +4,9 @@
     try {
         const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = after.client.logger
         let auditLog = await getAuditLog(after.guild, 'MEMBER_UPDATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
-        if (audit.executor.id == client.user.id) return;
-        if (before.nickname != after.nickname) {
+        let audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
+        if (audit.executor.id === client.user.id) return;
+        if (before.nickname !== after.nickname) {
             try { await client.database.history.create(
                 "nickname", after.guild.id, after.user, audit.executor,
                 null, before.nickname || before.user.username, after.nickname || after.user.username) } catch {}
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index ee02b66..e27975b 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -1,11 +1,14 @@
+import { callback as statsChannelUpdate } from '../reflex/statsChannelUpdate.js';
+
 export const event = 'guildUpdate'
 
 export async function callback(client, before, after) {
+    try { await statsChannelUpdate(client, after.me); } catch(e) { console.log(e)}
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = after.client.logger
         let auditLog = await getAuditLog(after, 'GUILD_UPDATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
+        if (audit.executor.id === client.user.id) return;
         let list = {}
 
         const verificationLevels = {
@@ -27,14 +30,14 @@
             ELEVATED: 'Enabled'
         }
 
-        if (before.name != after.name) list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
-        if (before.icon != after.icon) list["icon"] = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
-        if (before.splash != after.splash) list["splash"] = entry([before.splash, after.splash], `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`);
-        if (before.banner != after.banner) list["banner"] = entry([before.banner, after.banner], `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`);
-        if (before.owner != after.owner) list["owner"] = entry([before.owner, after.owner], `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`);
-        if (before.verificationLevel != after.verificationLevel) list["verificationLevel"] = entry([verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]], `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`);
-        if (before.explicitContentFilter != after.explicitContentFilter) list["explicitContentFilter"] = entry([explicitContentFilterLevels[before.explicitContentFilter], explicitContentFilterLevels[after.explicitContentFilter]], `${explicitContentFilterLevels[before.explicitContentFilter]} -> ${explicitContentFilterLevels[after.explicitContentFilter]}`);
-        if (before.mfaLevel != after.mfaLevel) list["2 factor authentication"] = entry([MFALevels[before.mfaLevel], MFALevels[after.mfaLevel]], `${MFALevels[before.mfaLevel]} -> ${MFALevels[after.mfaLevel]}`);
+        if (before.name !== after.name) list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
+        if (before.icon !== after.icon) list["icon"] = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
+        if (before.splash !== after.splash) list["splash"] = entry([before.splash, after.splash], `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`);
+        if (before.banner !== after.banner) list["banner"] = entry([before.banner, after.banner], `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`);
+        if (before.owner !== after.owner) list["owner"] = entry([before.owner, after.owner], `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`);
+        if (before.verificationLevel !== after.verificationLevel) list["verificationLevel"] = entry([verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]], `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`);
+        if (before.explicitContentFilter !== after.explicitContentFilter) list["explicitContentFilter"] = entry([explicitContentFilterLevels[before.explicitContentFilter], explicitContentFilterLevels[after.explicitContentFilter]], `${explicitContentFilterLevels[before.explicitContentFilter]} -> ${explicitContentFilterLevels[after.explicitContentFilter]}`);
+        if (before.mfaLevel !== after.mfaLevel) list["2 factor authentication"] = entry([MFALevels[before.mfaLevel], MFALevels[after.mfaLevel]], `${MFALevels[before.mfaLevel]} -> ${MFALevels[after.mfaLevel]}`);
 
         if (!(Object.keys(list).length)) return;
         list["updated"] = entry(new Date().getTime(), renderDelta(new Date().getTime()))
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 5081dd1..5d47bf8 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -5,8 +5,8 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger
         let auditLog = await getAuditLog(invite.guild, 'INVITE_CREATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == invite.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === invite.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'inviteCreate',
diff --git a/src/events/inviteDelete.ts b/src/events/inviteDelete.ts
index b6ddd22..acfc9dd 100644
--- a/src/events/inviteDelete.ts
+++ b/src/events/inviteDelete.ts
@@ -5,8 +5,8 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger
         let auditLog = await getAuditLog(invite.guild, 'INVITE_DELETE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == invite.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === invite.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'inviteDelete',
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index 122e01a..5dff86f 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -1,4 +1,3 @@
-import humanizeDuration from 'humanize-duration';
 import { purgeByUser } from '../actions/tickets/delete.js';
 import { callback as statsChannelRemove } from '../reflex/statsChannelUpdate.js';
 
@@ -6,10 +5,11 @@
 
 export async function callback(client, member) {
     try { purgeByUser(member.id, member.guild); } catch {}
+    try { await statsChannelRemove(client, member); } catch {}
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
         let auditLog = await getAuditLog(member.guild, 'MEMBER_KICK');
-        let audit = auditLog.entries.filter(entry => entry.target.id == member.id).first();
+        let audit = auditLog.entries.filter(entry => entry.target.id === member.id).first();
         let type = "leave"
         if (audit) {
             if (audit.executor.id === client.user.id) return
@@ -18,7 +18,7 @@
             }
         }
         let data
-        if (type == "kick") {
+        if (type === "kick") {
             try { await client.database.history.create("kick", member.guild.id, member.user, audit.executor, audit.reason) } catch {}
             data = {
                 meta: {
@@ -36,7 +36,6 @@
                     kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                     kickedBy: entry(audit.executor.id, renderUser(audit.executor)),
                     reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
-                    timeInServer: entry(new Date().getTime() - member.joinedAt, humanizeDuration(new Date().getTime() - member.joinedAt, { round: true })),
                     accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                     serverMemberCount: member.guild.memberCount,
                 },
@@ -60,7 +59,6 @@
                     name: entry(member.id, renderUser(member.user)),
                     joined: entry(member.joinedTimestamp, renderDelta(member.joinedAt)),
                     left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                    timeInServer: entry(new Date().getTime() - member.joinedTimestamp, humanizeDuration(new Date().getTime() - member.joinedAt, { round: true })),
                     accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                     serverMemberCount: member.guild.memberCount,
                 },
@@ -71,5 +69,4 @@
         }
         log(data);
     } catch (e) { console.log(e) }
-    try { await statsChannelRemove(client, member); } catch {}
 }
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index dce1959..cbb1fa2 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -1,14 +1,17 @@
 import { LinkCheck, MalwareCheck, NSFWCheck, SizeCheck, TestString, TestImage } from '../reflex/scanners.js'
 import logAttachment from '../premium/attachmentLogs.js'
 import createLogException from '../utils/createLogException.js'
-import getEmojiByName from '../utils/getEmojiByName.js'
+import getEmojiByName from '../utils/getEmojiByName.js';
+import client from '../utils/client.js';
+import {callback as a} from '../reflex/statsChannelUpdate.js'
 
 export const event = 'messageCreate'
 
-export async function callback(client, message) {
+export async function callback(_, message) {
     if(!message) return;
     if (message.author.bot) return
     if (message.channel.type === 'dm') return
+    try { await a(client, await message.guild.members.fetch(message.author.id)); } catch(e) { console.log(e)}
 
     const { log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger
 
@@ -66,7 +69,7 @@
         for (let element of fileNames.files) {
             if(!message) return;
             let url = element.url ? element.url : element.local
-            if (url != undefined) {
+            if (url !== undefined) {
                 if(/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)) {
                     if (config.filters.images.NSFW && !message.channel.nsfw) {
                         if (await NSFWCheck(url)) {
@@ -94,30 +97,28 @@
                     }
                     if (config.filters.wordFilter.enabled) {
                         let text = await TestImage(url)
-                        if (config.filters.wordFilter.enabled) {
-                            let check = TestString(text, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict)
-                            if(check !== null) {
-                                createLogException(message.guild.id, message.channel.id, message.id)
-                                await message.delete()
-                                let data = {
-                                    meta: {
-                                        type: 'messageDelete',
-                                        displayName: 'Message Deleted',
-                                        calculateType: 'autoModeratorDeleted',
-                                        color: NucleusColors.red,
-                                        emoji: 'MESSAGE.DELETE',
-                                        timestamp: new Date().getTime()
-                                    },
-                                    separate: {
-                                        start: filter + " Image contained filtered word\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*'),
-                                    },
-                                    list: list,
-                                    hidden: {
-                                        guild: message.channel.guild.id
-                                    }
+                        let check = TestString(text, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict)
+                        if(check !== null) {
+                            createLogException(message.guild.id, message.channel.id, message.id)
+                            await message.delete()
+                            let data = {
+                                meta: {
+                                    type: 'messageDelete',
+                                    displayName: 'Message Deleted',
+                                    calculateType: 'autoModeratorDeleted',
+                                    color: NucleusColors.red,
+                                    emoji: 'MESSAGE.DELETE',
+                                    timestamp: new Date().getTime()
+                                },
+                                separate: {
+                                    start: filter + " Image contained filtered word\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*'),
+                                },
+                                list: list,
+                                hidden: {
+                                    guild: message.channel.guild.id
                                 }
-                                return log(data);
                             }
+                            return log(data);
                         }
                     }
                     if (config.filters.images.size) {
@@ -199,6 +200,7 @@
         }
         return log(data);
     }
+
     if (config.filters.wordFilter.enabled) {
         let check = TestString(content, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict)
         if(check !== null) {
@@ -225,78 +227,73 @@
         }
     }
 
-    if (!config.filters.pings.allowed.users.includes(message.author.id) ||
-        !config.filters.pings.allowed.channels.includes(message.channel.id) ||
-        !message.author.roles.cache.some(role => config.filters.pings.allowed.roles.includes(role.id))
-    ) {
-        if (config.filters.pings.everyone && message.mentions.everyone) {
-            let data = {
-                meta: {
-                    type: 'everyonePing',
-                    displayName: 'Everyone Pinged',
-                    calculateType: 'messageMassPing',
-                    color: NucleusColors.yellow,
-                    emoji: 'MESSAGE.PING.EVERYONE',
-                    timestamp: new Date().getTime()
-                },
-                separate: {
-                    start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
-                },
-                list: list,
-                hidden: {
-                    guild: message.channel.guild.id
-                }
+    if (config.filters.pings.everyone && message.mentions.everyone) {
+        let data = {
+            meta: {
+                type: 'everyonePing',
+                displayName: 'Everyone Pinged',
+                calculateType: 'messageMassPing',
+                color: NucleusColors.yellow,
+                emoji: 'MESSAGE.PING.EVERYONE',
+                timestamp: new Date().getTime()
+            },
+            separate: {
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+            },
+            list: list,
+            hidden: {
+                guild: message.channel.guild.id
             }
-            return log(data);
         }
-        if (config.filters.pings.roles) {
-            for(let role of message.mentions.roles) {
-                if(!message) return;
-                if (!config.filters.pings.allowed.roles.includes(role.id)) {
-                    createLogException(message.guild.id, message.channel.id, message.id)
-                    await message.delete()
-                    let data = {
-                        meta: {
-                            type: 'rolePing',
-                            displayName: 'Role Pinged',
-                            calculateType: 'messageMassPing',
-                            color: NucleusColors.yellow,
-                            emoji: 'MESSAGE.PING.ROLE',
-                            timestamp: new Date().getTime()
-                        },
-                        separate: {
-                            start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
-                        },
-                        list: list,
-                        hidden: {
-                            guild: message.channel.guild.id
-                        }
+        return log(data);
+    }
+    if (config.filters.pings.roles) {
+        for(let role of message.mentions.roles) {
+            if(!message) return;
+            if (!config.filters.pings.allowed.roles.includes(role.id)) {
+                createLogException(message.guild.id, message.channel.id, message.id)
+                await message.delete()
+                let data = {
+                    meta: {
+                        type: 'rolePing',
+                        displayName: 'Role Pinged',
+                        calculateType: 'messageMassPing',
+                        color: NucleusColors.yellow,
+                        emoji: 'MESSAGE.PING.ROLE',
+                        timestamp: new Date().getTime()
+                    },
+                    separate: {
+                        start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+                    },
+                    list: list,
+                    hidden: {
+                        guild: message.channel.guild.id
                     }
-                    return log(data);
                 }
+                return log(data);
             }
         }
-        if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
-            createLogException(message.guild.id, message.channel.id, message.id)
-            await message.delete()
-            let data = {
-                meta: {
-                    type: 'massPing',
-                    displayName: `Mass Ping`,
-                    calculateType: 'messageMassPing',
-                    color: NucleusColors.yellow,
-                    emoji: 'MESSAGE.PING.MASS',
-                    timestamp: new Date().getTime()
-                },
-                separate: {
-                    start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
-                },
-                list: list,
-                hidden: {
-                    guild: message.channel.guild.id
-                }
+    }
+    if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
+        createLogException(message.guild.id, message.channel.id, message.id)
+        await message.delete()
+        let data = {
+            meta: {
+                type: 'massPing',
+                displayName: `Mass Ping`,
+                calculateType: 'messageMassPing',
+                color: NucleusColors.yellow,
+                emoji: 'MESSAGE.PING.MASS',
+                timestamp: new Date().getTime()
+            },
+            separate: {
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+            },
+            list: list,
+            hidden: {
+                guild: message.channel.guild.id
             }
-            return log(data);
         }
+        return log(data);
     }
 }
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index 3c23739..b139297 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -2,11 +2,11 @@
 
 export async function callback(client, message) {
     try {
-        if (message.author.id == client.user.id) return;
+        if (message.author.id === client.user.id) return;
         if (client.noLog.includes(`${message.guild.id}/${message.channel.id}/${message.id}`)) return;
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = message.channel.client.logger
         let auditLog = await getAuditLog(message.guild, 'MEMBER_BAN_ADD')
-        let audit = auditLog.entries.filter(entry => entry.target.id == message.author.id).first();
+        let audit = auditLog.entries.filter(entry => entry.target.id === message.author.id).first();
         if (audit) {
             if (audit.createdAt - 100 < new Date().getTime()) return;
         }
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index 5e63797..9e0e521 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -2,7 +2,7 @@
 
 export async function callback(client, oldMessage, newMessage) {
     try {
-        if (newMessage.author.id == client.user.id) return;
+        if (newMessage.author.id === client.user.id) return;
         const { log, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } = newMessage.channel.client.logger
         newMessage.reference = newMessage.reference || {}
         let newContent = newMessage.cleanContent.replaceAll("`", "‘")
@@ -10,7 +10,7 @@
         let attachmentJump = "";
         let config = (await client.database.guilds.read(newMessage.guild.id)).logging.attachments.saved[newMessage.channel.id + newMessage.id];
         if (config) { attachmentJump = ` [[View attachments]](${config})` }
-        if (newContent == oldContent) {
+        if (newContent === oldContent) {
             if (!oldMessage.flags.has("CROSSPOSTED") && newMessage.flags.has("CROSSPOSTED")) {
                 let data = {
                     meta: {
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index 6fded26..2f159ac 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -5,8 +5,8 @@
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderRole } = role.client.logger
         if (role.managed) return;
         let auditLog = await getAuditLog(role.guild, 'ROLE_CREATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === role.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'roleCreate',
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index 6a23d9e..3b43a55 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -7,8 +7,8 @@
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = role.client.logger
         if (role.managed) return;
         let auditLog = await getAuditLog(role.guild, 'ROLE_DELETE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === role.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'roleDelete',
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index 7c6ca75..7c03c97 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -8,7 +8,7 @@
 
         let auditLog = await getAuditLog(nr.guild, 'ROLE_UPDATE');
         let audit = auditLog.entries.first();
-        if (audit.executor.id == client.user.id) return;
+        if (audit.executor.id === client.user.id) return;
 
         let changes = {
             roleId: entry(nr.id, `\`${nr.id}\``),
@@ -22,13 +22,13 @@
         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]}`);
-        if (or.mentionable != nr.mentionable) 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}\``);
+        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]}`);
+        if (or.mentionable !== nr.mentionable) 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}\``);
 
-        if (Object.keys(changes).length == 4) return
+        if (Object.keys(changes).length === 4) return
 
         let data = {
             meta:{
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index b9511b0..669de32 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -4,8 +4,8 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger
         let auditLog = await getAuditLog(emoji.guild, 'STICKER_CREATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'stickerCreate',
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index 7490851..0431bda 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -4,8 +4,8 @@
     try{
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger
         let auditLog = await getAuditLog(emoji.guild, 'STICKER_DELETE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'stickerDelete',
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index 7cb745f..363e072 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -4,10 +4,10 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
 
-        if (oe.name == ne.name) return
+        if (oe.name === ne.name) return
         let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
         let audit = auditLog.entries.first();
-        if (audit.executor.id == client.user.id) return;
+        if (audit.executor.id === client.user.id) return;
 
         let changes = {
             stickerId:entry(ne.id, `\`${ne.id}\``),
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index ff69e35..ef7246d 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -5,8 +5,8 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger
         let auditLog = await getAuditLog(thread.guild, 'THREAD_CREATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == thread.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === thread.id).first();
+        if (audit.executor.id === client.user.id) return;
         let data = {
             meta: {
                 type: 'channelCreate',
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index 14c5820..9574826 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -5,8 +5,8 @@
     try {
     const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger
     let auditLog = await getAuditLog(thread.guild, 'THREAD_UPDATE');
-    let audit = auditLog.entries.filter(entry => entry.target.id == thread.id).first();
-    if (audit.executor.id == client.user.id) return;
+    let audit = auditLog.entries.filter(entry => entry.target.id === thread.id).first();
+    if (audit.executor.id === client.user.id) return;
     let data = {
         meta: {
             type: 'channelDelete',
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index 4e13193..8550ffe 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -5,20 +5,20 @@
     try {
         const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = after.client.logger
         let auditLog = await getAuditLog(after.guild, 'THREAD_UPDATE');
-        let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
-        if (audit.executor.id == client.user.id) return;
+        let audit = auditLog.entries.filter(entry => entry.target.id === after.id).first();
+        if (audit.executor.id === client.user.id) return;
         let list = {
             threadId:entry(after.id, `\`${after.id}\``),
             thread: entry(after.name, renderChannel(after)),
             parentChannel: entry(after.parentId, renderChannel(after.parent)),
         }
-        if (before.name != after.name) {
+        if (before.name !== after.name) {
             list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
         }
-        if (before.autoArchiveDuration != after.autoArchiveDuration) {
+        if (before.autoArchiveDuration !== after.autoArchiveDuration) {
             list["autoArchiveDuration"] = entry([before.autoArchiveDuration, after.autoArchiveDuration], `${humanizeDuration(before.autoArchiveDuration * 60 * 1000, { round: true })} -> ${humanizeDuration(after.autoArchiveDuration * 60 * 1000, { round: true })}`);
         }
-        if (before.rateLimitPerUser != after.rateLimitPerUser) {
+        if (before.rateLimitPerUser !== after.rateLimitPerUser) {
             list["slowmode"] = entry([before.rateLimitPerUser, after.rateLimitPerUser], `${humanizeDuration(before.rateLimitPerUser * 1000)} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`);
         }
         if (!(Object.keys(list).length - 3)) return;
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index 66b1cd0..28768b2 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -8,9 +8,9 @@
         let auditLogUpdate = getAuditLog(channel.guild, 'WEBHOOK_UPDATE');
         let auditLogDelete = getAuditLog(channel.guild, 'WEBHOOK_DELETE');
         [auditLogCreate, auditLogUpdate, auditLogDelete] = await Promise.all([auditLogCreate, auditLogUpdate, auditLogDelete]);
-        let auditCreate = auditLogCreate.entries.filter(entry => entry.target.channelId == channel.id).first();
-        let auditUpdate = auditLogUpdate.entries.filter(entry => entry.target.channelId == channel.id).first();
-        let auditDelete = auditLogDelete.entries.filter(entry => entry.target.channelId == channel.id).first();
+        let auditCreate = auditLogCreate.entries.filter(entry => entry.target.channelId === channel.id).first();
+        let auditUpdate = auditLogUpdate.entries.filter(entry => entry.target.channelId === channel.id).first();
+        let auditDelete = auditLogDelete.entries.filter(entry => entry.target.channelId === channel.id).first();
         if (!auditCreate && !auditUpdate && !auditDelete) return;
         let audit = auditCreate;
         let action = "Create";
diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index e1dfcc0..ed9a4ab 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -18,7 +18,7 @@
             attachments.push({local: await saveAttachment(link), url: link})
         }
     }
-    if (attachments.length == 0) return {files: []}
+    if (attachments.length === 0) return {files: []}
     if (client.database.premium.hasPremium(message.guild.id)) {
         let channel = (await client.database.guilds.read(message.guild.id)).logging.attachments.channel;
         if (!channel) {
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 92b268c..55697b9 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -13,7 +13,7 @@
     let messages = []
     let deleted = 100;
 
-    while (deleted == 100) {
+    while (deleted === 100) {
         let fetched;
         await (interaction.channel as TextChannel).messages.fetch({limit: 100}).then(async (ms) => {
             fetched = await (interaction.channel as TextChannel).bulkDelete(ms, true);
diff --git a/src/reflex/guide.ts b/src/reflex/guide.ts
index 39974e7..517d7f4 100644
--- a/src/reflex/guide.ts
+++ b/src/reflex/guide.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../utils/defaultEmbeds.js';
 import { SelectMenuOption } from '@discordjs/builders';
 import Discord, { MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -126,23 +127,8 @@
             ).setTitle("Premium").setDescription("Premium features").setPageId(7),
     ]
     let m;
-    if (interaction) {
-        m = await interaction.reply({embeds: [
-            new EmojiEmbed()
-                .setTitle("Welcome")
-                .setDescription(`One moment...`)
-                .setStatus("Danger")
-                .setEmoji("NUCLEUS.LOADING")
-        ], fetchReply: true, ephemeral: true});
-    } else {
-        m = await c.send({embeds: [
-            new EmojiEmbed()
-                .setTitle("Welcome")
-                .setDescription(`One moment...`)
-                .setStatus("Danger")
-                .setEmoji("NUCLEUS.LOADING")
-        ], fetchReply: true });
-    }
+    if (interaction) { m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true}); }
+    else { m = await c.send({embeds: LoadingEmbed }); }
     let page = 0;
 
     let f = async (component) => {
@@ -174,8 +160,7 @@
         let components = selectPane.concat([new MessageActionRow().addComponents([
             new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(page === 0),
             new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(false),
-            new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1),
-            new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER")
+            new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1)
         ])])
         if (interaction) {
             let em = new Discord.MessageEmbed(pages[page].embed)
@@ -198,56 +183,53 @@
             i = await m.awaitMessageComponent({filter: interaction ? () => { return true } : f, time: 300000});
         } catch(e) { break }
         i.deferUpdate()
-        if (i.component.customId == "left") {
+        if (i.component.customId === "left") {
             if (page > 0) page--;
             selectPaneOpen = false;
-        } else if (i.component.customId == "right") {
+        } else if (i.component.customId === "right") {
             if (page < pages.length - 1) page++;
             selectPaneOpen = false;
-        } else if (i.component.customId == "select") {
+        } else if (i.component.customId === "select") {
             selectPaneOpen = !selectPaneOpen;
-        } else if (i.component.customId == "page") {
+        } else if (i.component.customId === "page") {
             page = parseInt(i.values[0]);
             selectPaneOpen = false;
         } else {
             if (interaction) {
                 let em = new Discord.MessageEmbed(pages[page].embed)
-                em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message closed");
+                em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
+                em.setFooter({text: "Message closed"})
                 interaction.editReply({embeds: [em], components: [new MessageActionRow().addComponents([
                     new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
                     new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(true),
-                    new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true),
-                    new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER").setDisabled(true)
-                ])], fetchReply: true});
+                    new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true)
+                ])]});
             } else {
                 m.delete();
             }
             return;
         }
     }
-    const { NucleusColors } = client.logger
     if (interaction) {
         let em = new Discord.MessageEmbed(pages[page].embed)
-        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message timed out").setColor(NucleusColors.Danger);
+        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page)).setFooter({text: "Message timed out"});
         await interaction.editReply({
             embeds: [em],
             components: [new MessageActionRow().addComponents([
                 new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
                 new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER").setDisabled(true)
+                new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true)
             ])]
         });
     } else {
         let em = new Discord.MessageEmbed(pages[page].embed)
-        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message timed out").setColor(NucleusColors.Danger);
+        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page)).setFooter({text: "Message timed out"});
         await m.edit({
             embeds: [em],
             components: [new MessageActionRow().addComponents([
                 new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
                 new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER").setDisabled(true)
+                new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true)
             ])]
         });
     }
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index a1a5974..3b80816 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -84,7 +84,7 @@
 }
 
 export async function SizeCheck(element): Promise<boolean> {
-    if (element.height == undefined || element.width == undefined) return true
+    if (element.height === undefined || element.width === undefined) return true
     if (element.height < 20 || element.width < 20) return false
     return true
 }
@@ -105,7 +105,7 @@
     }
     for(let word of soft) {
         for(let word2 of string.match(/[a-z]+/gi) || []) {
-            if (word2 == word) {
+            if (word2 === word) {
                 return {word: word, type: "strict"}
             }
         }
diff --git a/src/reflex/statsChannelUpdate.ts b/src/reflex/statsChannelUpdate.ts
index 7d04c8f..b306ecc 100644
--- a/src/reflex/statsChannelUpdate.ts
+++ b/src/reflex/statsChannelUpdate.ts
@@ -17,15 +17,20 @@
                 fetchedChannel = await guild.channels.fetch(channel)
             } catch (e) { fetchedChannel = null }
             if (!fetchedChannel) {
+                let deleted = config.getKey("stats")[channel]
+                console.log(`stats.${channel}`)
+                console.log(guild.id)
+                await client.database.guilds.write(guild.id, null, `stats.${channel}`)
                 return singleNotify(
                     "statsChannelDeleted",
                     guild.id,
-                    "One or more of your stats channels have been deleted. Please open the settings menu to change this.",
+                    "One or more of your stats channels have been deleted. Please use `/settings stats` if you wish to add the channel again.\n" +
+                    `The channels name was: ${deleted.name}`,
                     "Critical"
                 )
             }
             try {
-                await fetchedChannel.setName(string)
+                await fetchedChannel.setName(string.slice(0, 100))
             } catch (e) {
                 console.error(e)
             }
diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index 9d90dde..b95cdb7 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../utils/defaultEmbeds.js';
 import Discord, { GuildMember } from "discord.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import fetch from "node-fetch";
@@ -11,12 +12,7 @@
 
 export default async function(interaction) {
     let verify = client.verify
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Loading")
-        .setDescription(step(-1))
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true, fetchReply: true});
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
     let config = await client.database.guilds.read(interaction.guild.id);
     if ((!config.verify.enabled ) || (!config.verify.role)) return interaction.editReply({embeds: [new EmojiEmbed()
         .setTitle("Verify")
@@ -40,7 +36,7 @@
     ]});
     try {
         let status = await fetch(client.config.baseUrl).then(res => res.status);
-        if (status != 200) {
+        if (status !== 200) {
             return await interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Verify")
                 .setDescription(`Our servers appear to be down, please try again later` + step(0))
diff --git a/src/utils/calculate.ts b/src/utils/calculate.ts
index 6b8c058..8badc58 100644
--- a/src/utils/calculate.ts
+++ b/src/utils/calculate.ts
@@ -49,7 +49,7 @@
     let permissions = [];
     let int = (BigInt("0x" + permissionsHex)).toString(2).split('').reverse();
     for (let index in int) {
-        if (int[index] == "1" && array.length > index) {
+        if (int[index] === "1" && array.length > index) {
             permissions.push(array[index]);
         }
     }
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 988fd37..dfdc3fb 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -148,7 +148,7 @@
                 });
                 let out;
                 try {
-                    out = await modalInteractionCollector(m, (m) => m.channel.id == this.interaction.channel.id, (m) => m.customId == "reason")
+                    out = await modalInteractionCollector(m, (m) => m.channel.id === this.interaction.channel.id, (m) => m.customId === "reason")
                 } catch (e) { return {} }
                 if (out.fields) { return { newReason: out.fields.getTextInputValue("reason") ?? "" }; }
                 else { return { newReason: this.reason } }
diff --git a/src/utils/createPageIndicator.ts b/src/utils/createPageIndicator.ts
index 8e18e30..fa203dc 100644
--- a/src/utils/createPageIndicator.ts
+++ b/src/utils/createPageIndicator.ts
@@ -3,13 +3,13 @@
 function pageIndicator(amount: number, selected: number, showDetails?: boolean | true) {
     let out = "";
 
-    if (amount == 1) {
-        out += getEmojiByName("TRACKS.SINGLE." + (selected == 0 ? "ACTIVE" : "INACTIVE"));
+    if (amount === 1) {
+        out += getEmojiByName("TRACKS.SINGLE." + (selected === 0 ? "ACTIVE" : "INACTIVE"));
     } else {
         for (let i = 0; i < amount; i++) {
             out += getEmojiByName("TRACKS.HORIZONTAL." +
-                (i == 0 ? "LEFT" : (i == amount - 1 ? "RIGHT" : "MIDDLE")) + "." +
-                (i == selected ? "ACTIVE" : "INACTIVE")
+                (i === 0 ? "LEFT" : (i === amount - 1 ? "RIGHT" : "MIDDLE")) + "." +
+                (i === selected ? "ACTIVE" : "INACTIVE")
             );
         }
     }
diff --git a/src/utils/database.ts b/src/utils/database.ts
index d24c7bf..2f04198 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -40,14 +40,16 @@
         return new Proxy(structuredClone(this.defaultData), Entry(entry)) as unknown as GuildConfig
     }
 
-    async write(guild: string, set: object = {}, unset: string[] = []) {
+    async write(guild: string, set: object | null, unset: string[] | string = []) {
         let uo = {}
+        if (!Array.isArray(unset)) unset = [unset]
         for (let key of unset) {
             uo[key] = null;
         }
-        let out = {}
+        let out = {$set: {}, $unset: {}}
         if (set) out["$set"] = set;
         if (unset.length) out["$unset"] = uo;
+        console.log(out)
         await this.guilds.updateOne({ id: guild }, out, { upsert: true });
     }
 
@@ -79,6 +81,10 @@
             }, { upsert: true });
         }
     }
+
+    async delete(guild: string) {
+        await this.guilds.deleteOne({ id: guild });
+    }
 }
 
 
@@ -116,6 +122,10 @@
         }).toArray()) as HistorySchema[];
         return entry;
     }
+
+    async delete(guild: string) {
+        await this.histories.deleteMany({ guild: guild });
+    }
 }
 
 export class ModNotes {
@@ -147,7 +157,7 @@
 
     async hasPremium(guild: string) {
         let entry = await this.premium.findOne({ appliesTo: { $in: [guild] } });
-        return entry != null;
+        return entry !== null;
     }
 }
 
diff --git a/src/utils/defaultEmbeds.ts b/src/utils/defaultEmbeds.ts
new file mode 100644
index 0000000..0f226da
--- /dev/null
+++ b/src/utils/defaultEmbeds.ts
@@ -0,0 +1,8 @@
+import EmojiEmbed from "./generateEmojiEmbed.js"
+
+export const LoadingEmbed = [new EmojiEmbed()
+    .setTitle("Loading")
+    .setDescription("One moment...")
+    .setStatus("Danger")
+    .setEmoji("NUCLEUS.LOADING")]
+
diff --git a/src/utils/log.ts b/src/utils/log.ts
index 987e256..22da837 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -11,7 +11,7 @@
 
 export class Logger {
     renderUser(user: Discord.User | string) {
-        if (typeof user == 'string') return `${user} [<@${user}>]`;
+        if (typeof user === 'string') return `${user} [<@${user}>]`;
         return `${user.username} [<@${user.id}>]`;
     }
     renderTime(t: number) {
@@ -55,7 +55,7 @@
     async log(log: any): Promise<void> {
         let config = await client.database.guilds.read(log.hidden.guild);
         if (!config.logging.logs.enabled) return;
-        if (!(log.meta.calculateType == true)) {
+        if (!(log.meta.calculateType === true)) {
             if(!toHexArray(config.logging.logs.toLog).includes(log.meta.calculateType)) return console.log('Not logging this type of event');
         }
         if (config.logging.logs.channel) {
@@ -84,20 +84,8 @@
                 channel.send({embeds: [embed]});
             }
         }
-        saveLog(log);
     }
 }
 
 
 export default {}
-
-async function saveLog(log: any): Promise<void> {
-}
-
-export function readLogs(guild: string) {
-    
-}
-
-export function readSpecificLog(guild: string, id: number) {
-    
-}
diff --git a/src/utils/singleNotify.ts b/src/utils/singleNotify.ts
index 051ec4d..f29d775 100644
--- a/src/utils/singleNotify.ts
+++ b/src/utils/singleNotify.ts
@@ -7,11 +7,13 @@
     "Info": "Success"
 }
 
-export default async function(type: string, guild: string, message: string, severity: string) {
+export default async function(type: string, guild: string, message: string | true, severity?: string) {
     let data = await client.database.guilds.read(guild);
+    if (message === true) {
+        return await client.database.guilds.write(guild, {[`singleEventNotifications.${type}`]: false});
+    }
     if (data.singleEventNotifications[type]) return;
-    data.singleEventNotifications[type] = true;
-    client.database.guilds.write(guild, data);
+    await client.database.guilds.write(guild, {[`singleEventNotifications.${type}`]: true});
     try {
         let channel = await client.channels.fetch(data.logging.staff.channel);
         if (!channel) return;
