diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 1c9db24..9d2c2b1 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -25,23 +25,23 @@
         ], components: [new ActionRowBuilder<ButtonBuilder>().addComponents(new ButtonBuilder().setStyle(ButtonStyle.Link).setLabel("Join").setURL("https://discord.gg/bPaNnxe"))] });
         return;
     }
-    const dbMember = await client.database.premium.fetchTotal(interaction.user.id)
-    let premium;
+    const dbMember = await client.database.premium.fetchUser(interaction.user.id)
+    let premium = `You do not have premium! You can't activate premium on any servers.`;
     let count = 0;
-    if (member.roles.cache.has("1066468879309750313")) {
+    const {level, appliesTo} = dbMember || {level: 0, appliesTo: []}
+    if (level === 99) {
         premium = `You have Infinite Premium! You have been gifted this by the developers as a thank you. You can give premium to any and all servers you are in.`;
         count = 200;
-    } else if (member.roles.cache.has("1066465491713003520")) {
-        premium = `You have Premium tier 1! You can give premium to ${1 - dbMember}.`;
+    } else if (level === 1) {
+        premium = `You have Premium tier 1! You can give premium to ${1 - appliesTo.length} more servers.`;
         count = 1;
-    } else if (member.roles.cache.has("1066439526496604194")) {
-        premium = `You have Premium tier 2! You can give premium to ${3 - dbMember}.`;
+    } else if (level === 2) {
+        premium = `You have Premium tier 2! You can give premium to ${3 - appliesTo.length} more servers.`;
         count = 3;
-    } else if (member.roles.cache.has("1066464134322978912")) {
-        premium = `You have Premium Mod! You already give premium to all servers you have a "manage" permission in.`
+    } else if (level === 3) {
+        premium = `You have Premium Mod! You can give premium to ${3 - appliesTo.length} more servers, as well as automatically giving premium to all servers you have a "manage" permission in.`
         count = 3;
     }
-
     const hasPremium = await client.database.premium.hasPremium(interaction.guild!.id);
     let premiumGuild = ""
     if (hasPremium) {
@@ -82,8 +82,7 @@
         if (i) {
             i.deferUpdate();
             let guild = i.guild!;
-            let m = await client.database.premium.fetchTotal(interaction.user.id);
-            if (count - m <= 0) {
+            if (count - appliesTo.length <= 0) {
                 interaction.editReply({
                     embeds: [
                         new EmojiEmbed()
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index c55e463..b929d3d 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -1,5 +1,4 @@
 import fetch from "node-fetch";
-import FormData from "form-data";
 import fs, { writeFileSync, createReadStream } from "fs";
 import generateFileName from "../utils/temp/generateFileName.js";
 import Tesseract from "node-tesseract-ocr";
@@ -20,8 +19,9 @@
     const [p, hash] = await saveAttachment(link);
     let alreadyHaveCheck = await client.database.scanCache.read(hash)
     if(alreadyHaveCheck) return { nsfw: alreadyHaveCheck.data };
-    const data = new FormData();
-    data.append("file", createReadStream(p));
+    const data = new URLSearchParams();
+    let r = createReadStream(p)
+    data.append("file", r.read(fs.statSync(p).size));
     const result = await fetch("https://unscan.p.rapidapi.com/", {
         method: "POST",
         headers: {
diff --git a/src/utils/database.ts b/src/utils/database.ts
index c7b1777..c85b43a 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -1,6 +1,7 @@
 import type Discord from "discord.js";
 import { Collection, MongoClient } from "mongodb";
 import config from "../config/main.json" assert { type: "json" };
+import client from "../utils/client.js";
 
 const mongoClient = new MongoClient(config.mongoUrl);
 await mongoClient.connect();
@@ -230,18 +231,55 @@
         this.premium = database.collection<PremiumSchema>("premium");
     }
 
+    async updateUser(user: string, level: number) {
+        if(!(await this.userExists(user))) await this.createUser(user, level);
+        await this.premium.updateOne({ user: user }, { $set: { level: level } }, { upsert: true });
+    }
+
+    async userExists(user: string): Promise<boolean> {
+        const entry = await this.premium.findOne({ user: user });
+        return entry ? true : false;
+    }
+
+    async createUser(user: string, level: number) {
+        await this.premium.insertOne({ user: user, appliesTo: [], level: level });
+    }
+
     async hasPremium(guild: string) {
         const entry = await this.premium.findOne({
             appliesTo: { $in: [guild] }
         });
-        if (!entry) return false;
-        return entry.expires.valueOf() > Date.now();
+        return entry ? true : false;
     }
 
-    async fetchTotal(user: string): Promise<number> {
+    async fetchUser(user: string): Promise<PremiumSchema | null> {
         const entry = await this.premium.findOne({ user: user });
-        if (!entry) return 0;
-        return entry.appliesTo.length;
+        if (!entry) return null;
+        return entry;
+    }
+
+    async checkAllPremium() {
+        const entries = await this.premium.find({}).toArray();
+        for(const {user, expiresAt} of entries) {
+            if(expiresAt) expiresAt < new Date().getTime() ? await this.premium.deleteOne({user: user}) : null;
+            const member = await (await client.guilds.fetch("684492926528651336")).members.fetch(user)
+            let level: number = 0;
+            if (member.roles.cache.has("1066468879309750313")) {
+                level = 99;
+            } else if (member.roles.cache.has("1066465491713003520")) {
+                level = 1;
+            } else if (member.roles.cache.has("1066439526496604194")) {
+                level = 2;
+            } else if (member.roles.cache.has("1066464134322978912")) {
+                level = 3;
+            }
+
+            if (level > 0) {
+                await this.updateUser(user, level);
+            } else {
+                await this.premium.updateOne({ user: user }, { expiresAt: (new Date().getTime() + (1000*60*60*24*3)) })
+            }
+        }
     }
 
     addPremium(user: string, guild: string) {
@@ -409,6 +447,6 @@
 export interface PremiumSchema {
     user: string;
     level: number;
-    expires: Date;
     appliesTo: string[];
+    expiresAt?: number;
 }
