diff --git a/src/commands/server/buttons.ts b/src/commands/server/buttons.ts
index 74c255c..c89e481 100644
--- a/src/commands/server/buttons.ts
+++ b/src/commands/server/buttons.ts
@@ -20,6 +20,7 @@
 import lodash from "lodash";
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import { modalInteractionCollector } from "../../utils/dualCollector.js";
+import _ from "lodash";
 
 export const command = new SlashCommandSubcommandBuilder()
     .setName("buttons")
@@ -50,6 +51,27 @@
     createticket: "Create Ticket"
 };
 
+const presetButtons = [
+    {
+        title: "Verify",
+        description: "Click the button below to get verified in the server.",
+        buttons: ["verifybutton"],
+        color: "GREEN"
+    },
+    {
+        title: "Get Roles",
+        description: "Click the button to choose which roles you would like in the server",
+        buttons: ["rolemenu"],
+        color: "BLUE"
+    },
+    {
+        title: "Create Ticket",
+        description: "Click the button below to create a ticket",
+        buttons: ["createticket"],
+        color: "RED"
+    }
+]
+
 export const callback = async (interaction: CommandInteraction): Promise<void> => {
     const m = await interaction.reply({
         embeds: LoadingEmbed,
@@ -58,7 +80,7 @@
     });
 
     let closed = false;
-    const data: Data = {
+    let data: Data = {
         buttons: [],
         title: null,
         description: null,
@@ -71,7 +93,7 @@
                 .setCustomId("edit")
                 .setLabel("Edit Embed")
                 .setStyle(ButtonStyle.Secondary)
-                .setEmoji(getEmojiByName("ICONS.EDIT") as APIMessageComponentEmoji),
+                .setEmoji(getEmojiByName("ICONS.EDIT", "id") as APIMessageComponentEmoji),
             new ButtonBuilder()
                 .setCustomId("send")
                 .setLabel("Send")
@@ -95,6 +117,22 @@
                 )
         );
 
+        const presetSelect = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
+            new StringSelectMenuBuilder()
+                .setCustomId("preset")
+                .setPlaceholder("Select a preset")
+                .setMaxValues(1)
+                .addOptions(
+                    presetButtons.map((preset, i) => {
+                        return new StringSelectMenuOptionBuilder()
+                            .setLabel(preset.title)
+                            .setValue(i.toString())
+                            .setDescription(preset.description)
+                            .setEmoji(getEmojiByName("COLORS." + preset.color, "id") as APIMessageComponentEmoji)
+                    })
+                )
+        )
+
         const buttonSelect = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
             new StringSelectMenuBuilder()
                 .setCustomId("button")
@@ -141,7 +179,7 @@
 
         await interaction.editReply({
             embeds: [embed],
-            components: [colorSelect, buttonSelect, channelMenu, buttons]
+            components: [presetSelect, colorSelect, buttonSelect, channelMenu, buttons]
         });
 
         let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction | Discord.StringSelectMenuInteraction;
@@ -257,6 +295,12 @@
                 console.log(err);
             }
             switch (i.customId) {
+                case "preset": {
+                    const chosen = presetButtons[parseInt(i.values[0]!)]!;
+                    const newColor = colors[chosen.color!]!
+                    data = _.assign(data, chosen, { color: newColor });
+                    break;
+                }
                 case "color": {
                     data.color = colors[i.values[0]!]!;
                     break;
diff --git a/src/commands/settings/tracks.ts b/src/commands/settings/tracks.ts
index 60a7eae..c81eeed 100644
--- a/src/commands/settings/tracks.ts
+++ b/src/commands/settings/tracks.ts
@@ -171,6 +171,7 @@
     const isAdmin = (interaction.member!.permissions as PermissionsBitField).has("Administrator");
     if (!current) {
         current = _.cloneDeep(defaultTrackData);
+        current.name = "Default";
     }
 
     const roleSelect = new ActionRowBuilder<RoleSelectMenuBuilder>().addComponents(
@@ -348,16 +349,15 @@
 const callback = async (interaction: CommandInteraction) => {
     const m = await interaction.reply({ embeds: LoadingEmbed, fetchReply: true, ephemeral: true });
     const config = await client.database.guilds.read(interaction.guild!.id);
-    const tracks: ObjectSchema[] = config.tracks;
+    const tracks: ObjectSchema[] = _.cloneDeep(config.tracks);
     const roles = await interaction.guild!.roles.fetch();
 
     let page = 0;
     let closed = false;
-    let modified = false;
 
     do {
         const embed = new EmojiEmbed().setTitle("Track Settings").setEmoji("TRACKS.ICON").setStatus("Success");
-        const noTracks = config.tracks.length === 0;
+        const noTracks = tracks.length === 0;
         let current: ObjectSchema;
 
         const pageSelect = new StringSelectMenuBuilder().setCustomId("page").setPlaceholder("Select a track to manage");
@@ -398,7 +398,7 @@
                 .setLabel("Save")
                 .setEmoji(getEmojiByName("ICONS.SAVE", "id") as APIMessageComponentEmoji)
                 .setStyle(ButtonStyle.Success)
-                .setDisabled(!modified)
+                .setDisabled(_.isEqual(tracks, config.tracks))
         );
         if (noTracks) {
             embed.setDescription(
@@ -471,13 +471,15 @@
                 case "add": {
                     const newPage = await editTrack(i, m, roles);
                     if (_.isEqual(newPage, defaultTrackData)) break;
-                    tracks.push();
+                    if(!newPage) break;
+                    console.log(newPage)
+                    tracks.push(newPage);
+                    console.log(tracks)
                     page = tracks.length - 1;
                     break;
                 }
                 case "save": {
                     await client.database.guilds.write(interaction.guild!.id, { tracks: tracks });
-                    modified = false;
                     await client.memory.forceUpdate(interaction.guild!.id);
                     break;
                 }
@@ -490,7 +492,6 @@
                             const edited = await editTrack(i, m, roles, current!);
                             if (!edited) break;
                             tracks[page] = edited;
-                            modified = true;
                             break;
                         }
                         case "delete": {
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index ee69868..92553ff 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -97,7 +97,8 @@
                 selected.length
             } roles from this track. `;
             conflictDropdown = [];
-            if (roles.get(selected[0]!)!.position < memberRoles.highest.position || managed) {
+            const yourRoles = guild.members.cache.get(interaction.user.id)!.roles;
+            if ((roles.get(selected[0]!)!.position < yourRoles.highest.position && roles.get(selected[0]!)!.position < guild.members.me!.roles.highest.position!) || managed) {
                 generated +=
                     "In order to promote or demote this user, you must select which role the member should keep.";
                 selected.forEach((role) => {
@@ -115,8 +116,13 @@
                         .setPlaceholder("Select a role to keep")
                 ];
             } else {
-                generated +=
-                    "You don't have permission to manage one or more of the users roles, and therefore can't select one to keep.";
+                if(roles.get(selected[0]!)!.position >= yourRoles.highest.position) {
+                    generated +=
+                        "You don't have permission to manage one or more of the user's roles, and therefore can't select one to keep.";
+                } else {
+                    generated +=
+                        "I don't have permission to manage one or more of the user's roles, and therefore can't select one to keep."
+                }
             }
         } else {
             currentRoleIndex = selected.length === 0 ? -1 : data.track.indexOf(selected[0]!.toString());
@@ -183,6 +189,7 @@
             const rolesToRemove = selected.filter(
                 (role) => role !== (component as StringSelectMenuInteraction).values[0]
             );
+
             await member.roles.remove(rolesToRemove);
         } else if (component.customId === "promote") {
             if (
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index 80ca150..b6860d1 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -210,18 +210,14 @@
 
 export async function doMemberChecks(member: Discord.GuildMember): Promise<void> {
     if (member.user.bot) return;
-    console.log("Checking member " + member.user.tag);
     const guild = member.guild;
     const guildData = await client.database.guilds.read(guild.id);
     if (!guildData.logging.staff.channel) return;
     const [loose, strict] = [guildData.filters.wordFilter.words.loose, guildData.filters.wordFilter.words.strict];
-    console.log(1, loose, strict);
     // Does the username contain filtered words
     const usernameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled);
-    console.log(2, usernameCheck);
     // Does the nickname contain filtered words
     const nicknameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled);
-    console.log(3, nicknameCheck);
     // Does the profile picture contain filtered words
     const avatarTextCheck = TestString(
         (await TestImage(member.displayAvatarURL({ forceStatic: true }))) ?? "",
@@ -229,18 +225,14 @@
         strict,
         guildData.filters.wordFilter.enabled
     );
-    console.log(4, avatarTextCheck);
     // Is the profile picture NSFW
     const avatar = member.displayAvatarURL({ extension: "png", size: 1024, forceStatic: true });
     const avatarCheck = guildData.filters.images.NSFW && (await NSFWCheck(avatar));
-    console.log(5, avatarCheck);
     // Does the username contain an invite
     const inviteCheck = guildData.filters.invite.enabled && /discord\.gg\/[a-zA-Z0-9]+/gi.test(member.user.username);
-    console.log(6, inviteCheck);
     // Does the nickname contain an invite
     const nicknameInviteCheck =
         guildData.filters.invite.enabled && /discord\.gg\/[a-zA-Z0-9]+/gi.test(member.nickname ?? "");
-    console.log(7, nicknameInviteCheck);
     if (
         usernameCheck !== null ||
         nicknameCheck !== null ||
@@ -282,39 +274,45 @@
                 `**Member:** ${member.user.username} (<@${member.user.id}>)\n\n` +
                     infractions.map((element) => `${filter} ${element}`).join("\n")
             );
+        const buttons = [
+            new ButtonBuilder()
+                .setCustomId(`mod:warn:${member.user.id}`)
+                .setLabel("Warn")
+                .setStyle(ButtonStyle.Primary),
+            new ButtonBuilder()
+                .setCustomId(`mod:mute:${member.user.id}`)
+                .setLabel("Mute")
+                .setStyle(ButtonStyle.Primary),
+            new ButtonBuilder()
+                .setCustomId(`mod:kick:${member.user.id}`)
+                .setLabel("Kick")
+                .setStyle(ButtonStyle.Danger),
+            new ButtonBuilder()
+                .setCustomId(`mod:ban:${member.user.id}`)
+                .setLabel("Ban")
+                .setStyle(ButtonStyle.Danger)
+        ]
+        if (usernameCheck !== null || nicknameCheck !== null) buttons.concat([
+            new ButtonBuilder()
+                .setCustomId(`mod:nickname:${member.user.id}`)
+                .setLabel("Change Name")
+                .setStyle(ButtonStyle.Primary)
+        ])
+        if (avatarCheck || avatarTextCheck !== null) buttons.concat([
+            new ButtonBuilder()
+                .setURL(member.displayAvatarURL())
+                .setLabel("View Avatar")
+                .setStyle(ButtonStyle.Link)
+        ])
+        const components: ActionRowBuilder<ButtonBuilder>[] = []
+
+        for (let i = 0; i < buttons.length; i += 5) {
+            components.push(new ActionRowBuilder<ButtonBuilder>().addComponents(buttons.slice(i, Math.min(buttons.length - 1, i + 5))))
+        }
+
         await channel.send({
             embeds: [embed],
-            components: [
-                new ActionRowBuilder<ButtonBuilder>().addComponents(
-                    ...[
-                        new ButtonBuilder()
-                            .setCustomId(`mod:warn:${member.user.id}`)
-                            .setLabel("Warn")
-                            .setStyle(ButtonStyle.Primary),
-                        new ButtonBuilder()
-                            .setCustomId(`mod:mute:${member.user.id}`)
-                            .setLabel("Mute")
-                            .setStyle(ButtonStyle.Primary),
-                        new ButtonBuilder()
-                            .setCustomId(`mod:kick:${member.user.id}`)
-                            .setLabel("Kick")
-                            .setStyle(ButtonStyle.Danger),
-                        new ButtonBuilder()
-                            .setCustomId(`mod:ban:${member.user.id}`)
-                            .setLabel("Ban")
-                            .setStyle(ButtonStyle.Danger)
-                    ].concat(
-                        usernameCheck !== null || nicknameCheck !== null
-                            ? [
-                                  new ButtonBuilder()
-                                      .setCustomId(`mod:nickname:${member.user.id}`)
-                                      .setLabel("Change Name")
-                                      .setStyle(ButtonStyle.Primary)
-                              ]
-                            : []
-                    )
-                )
-            ]
+            components: components
         });
     }
 }
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index 99d1215..9bbf61f 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,7 +1,6 @@
 import emojis from "../config/emojis.json" assert { type: "json" };
-import lodash from "lodash";
+import _ from "lodash";
 
-const isArray = lodash.isArray;
 interface EmojisIndex {
     [key: string]: string | EmojisIndex | EmojisIndex[];
 }
@@ -14,7 +13,7 @@
         if (typeof id === "string" || id === undefined) {
             throw new Error(`Emoji ${name} not found`);
         }
-        if (isArray(id)) {
+        if (_.isArray(id)) {
             id = id[parseInt(part)];
         } else {
             id = id[part];
@@ -34,9 +33,9 @@
     if (id === undefined) {
         return "";
     } else if (id.toString().startsWith("a")) {
-        return `<a:_:${id.toString().slice(1, id.toString().length)}>`;
+        return `<a:N:${id.toString().slice(1, id.toString().length)}>`;
     }
-    return `<:_:${id}>`;
+    return `<:N:${id}>`;
 }
 
 export default getEmojiByName;
