diff --git a/index.ts b/index.ts
index eda275f..d5092f5 100644
--- a/index.ts
+++ b/index.ts
@@ -1,5 +1,5 @@
 import { ChannelType, Client, Collection, Guild, GuildEmoji, GuildInvitableChannelResolvable, IntentsBitField } from 'discord.js';
-import { writeFileSync, readdirSync, readFileSync } from 'fs'
+import { writeFileSync, readdirSync, readFileSync, Dirent } from 'fs'
 import Canvas from 'canvas';
 import GIFEncoder from 'gifencoder';
 import Sharp from 'sharp';
@@ -75,20 +75,12 @@
     });
 });
 
-client.once('ready', async (client) => {
-    if (!process.env.EMOJI_DIR) throw new Error("Missing Emoji Directory");
-    console.log('ready')
-    let emojis: Collection<string, string> = new Collection();
-    const dir = readdirSync(process.env.EMOJI_DIR, {
-        withFileTypes: true
-    }).filter(file => file.isFile());
-    console.log(dir)
-    const emojiFiles = dir.filter(file => file.name.endsWith('.png'));
-
-    let currentEmojiIndex = 0;
-    const guilds = await propogateGuilds(client);
-    console.log('Fetched Guilds');
-
+async function guildLoop(
+    guilds: Collection<string, Guild>,
+    currentEmojiIndex: number,
+    emojis: Collection<string, string>,
+    emojiFiles: Dirent[],
+    secondLoop: boolean = false): Promise<[number, Collection<string, string>]> {
     for (const [_gid, guild] of guilds) {
         if (guild.invites.cache.size > 0) {
             console.log(`${guild.name}: ${guild.invites.cache.first()?.url}`);
@@ -110,7 +102,9 @@
 
         while (emojiCount > 0 && !(currentEmojiIndex >= emojiFiles.length)) {
             let emoji = emojiFiles[currentEmojiIndex];
-            let attachment = readFileSync(`${process.env.EMOJI_DIR}/${emoji.name}`);
+            let attachment = !secondLoop ?
+                readFileSync(`${process.env.EMOJI_DIR}/${emoji.name}`) :
+                await staticToAnimatedEmoji(`${process.env.EMOJI_DIR}/${emoji.name}`);
             let longName = emoji.name.split('.')[0].split('_').pop()!.replaceAll(/\-/g, "_");
             let name = longName.substring(0, Math.min(longName.length, 32));
             let i = 1;
@@ -128,6 +122,28 @@
         console.log(`completed emojis for ${guild.name}`);
 
     }
+    return [currentEmojiIndex, emojis]
+}
+
+client.once('ready', async (client) => {
+    if (!process.env.EMOJI_DIR) throw new Error("Missing Emoji Directory");
+    console.log('ready')
+    let emojis: Collection<string, string> = new Collection();
+    const dir = readdirSync(process.env.EMOJI_DIR, {
+        withFileTypes: true
+    }).filter(file => file.isFile());
+    console.log(dir)
+    let emojiFiles = dir.filter(file => file.name.endsWith('.png'));
+
+    let currentEmojiIndex = 0;
+    const guilds = await propogateGuilds(client);
+    console.log('Fetched Guilds');
+
+    [currentEmojiIndex, emojis] = await guildLoop(guilds, currentEmojiIndex, emojis, emojiFiles);
+
+    if (currentEmojiIndex < emojiFiles.length) [currentEmojiIndex, emojis] = await guildLoop(guilds, currentEmojiIndex, emojis, emojiFiles, true);
+
+    if (currentEmojiIndex < emojiFiles.length) console.error("Not Enough Emoji Slots");
 
     console.log('Creating out.json');
 
