diff --git a/src/utils/database.ts b/src/utils/database.ts
index 0688888..1e2d3ba 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -5,10 +5,22 @@
 import client from "../utils/client.js";
 import * as crypto from "crypto";
 
-const mongoClient = new MongoClient(config.mongoUrl);
+// config.mongoOptions.host, {
+//     auth: {
+//         username: config.mongoOptions.username,
+//         password: config.mongoOptions.password
+//     },
+//     authSource: config.mongoOptions.authSource
+// }
+// mongodb://emails:SweetLife2023!!@127.0.0.1:28180/saveEmail?retryWrites=true&w=majority
+const username = encodeURIComponent(config.mongoOptions.username);
+const password = encodeURIComponent(config.mongoOptions.password);
+const mongoClient = new MongoClient(username ? `mongodb://${username}:${password}@${config.mongoOptions.host}` : `mongodb://${config.mongoOptions.host}`, {authSource: "admin"});
 await mongoClient.connect();
 const database = mongoClient.db();
 
+const collectionOptions = { authdb: "admin" };
+
 export class Guilds {
     guilds: Collection<GuildConfig>;
     defaultData: GuildConfig | null;
@@ -25,11 +37,13 @@
     }
 
     async read(guild: string): Promise<GuildConfig> {
+        console.log("Guild read")
         const entry = await this.guilds.findOne({ id: guild });
         return Object.assign({}, this.defaultData, entry);
     }
 
     async write(guild: string, set: object | null, unset: string[] | string = []) {
+        console.log("Guild write")
         // eslint-disable-next-line @typescript-eslint/no-explicit-any
         const uo: Record<string, any> = {};
         if (!Array.isArray(unset)) unset = [unset];
@@ -44,6 +58,7 @@
 
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     async append(guild: string, key: string, value: any) {
+        console.log("Guild append")
         if (Array.isArray(value)) {
             await this.guilds.updateOne(
                 { id: guild },
@@ -70,6 +85,7 @@
         value: any,
         innerKey?: string | null
     ) {
+        console.log("Guild remove")
         if (innerKey) {
             await this.guilds.updateOne(
                 { id: guild },
@@ -98,6 +114,7 @@
     }
 
     async delete(guild: string) {
+        console.log("Guild delete")
         await this.guilds.deleteOne({ id: guild });
     }
 }
@@ -114,6 +131,13 @@
         text: string;
         iconURL?: string;
     };
+    color?: number;
+    timestamp?: string;
+    author?: {
+        name: string;
+        iconURL?: string;
+        url?: string;
+    };
 }
 
 interface TranscriptComponent {
@@ -178,17 +202,19 @@
     }
 
     async create(transcript: Omit<TranscriptSchema, "code">) {
+        console.log("Transcript create")
         let code;
         do {
             code = crypto.randomBytes(64).toString("base64").replace(/=/g, "").replace(/\//g, "_").replace(/\+/g, "-");
         } while (await this.transcripts.findOne({ code: code }));
 
-        const doc = await this.transcripts.insertOne(Object.assign(transcript, { code: code }));
+        const doc = await this.transcripts.insertOne(Object.assign(transcript, { code: code }), collectionOptions);
         if(doc.acknowledged) return code;
         else return null;
     }
 
     async read(code: string) {
+        console.log("Transcript read")
         return await this.transcripts.findOne({ code: code });
     }
 
@@ -233,7 +259,7 @@
                     topRole: {
                         color: message.member!.roles.highest.color
                     },
-                    iconURL: member!.user.displayAvatarURL({ forceStatic: true}),
+                    iconURL: message.member!.user.displayAvatarURL({ forceStatic: true}),
                     bot: message.author.bot
                 },
                 createdTimestamp: message.createdTimestamp
@@ -252,10 +278,17 @@
                         inline: field.inline ?? false
                     }
                 });
+                if (embed.color) obj.color = embed.color;
+                if (embed.timestamp) obj.timestamp = embed.timestamp
                 if (embed.footer) obj.footer = {
                     text: embed.footer.text,
                 };
                 if (embed.footer?.iconURL) obj.footer!.iconURL = embed.footer.iconURL;
+                if (embed.author) obj.author = {
+                    name: embed.author.name
+                };
+                if (embed.author?.iconURL) obj.author!.iconURL = embed.author.iconURL;
+                if (embed.author?.url) obj.author!.url = embed.author.url;
                 return obj;
             });
             if (message.components.length > 0) msg.components = message.components.map(component => component.components.map(child => {
@@ -347,6 +380,7 @@
         after?: string | null,
         amount?: string | null
     ) {
+        console.log("History create");
         await this.histories.insertOne({
             type: type,
             guild: guild,
@@ -357,10 +391,11 @@
             before: before ?? null,
             after: after ?? null,
             amount: amount ?? null
-        });
+        }, collectionOptions);
     }
 
     async read(guild: string, user: string, year: number) {
+        console.log("History read");
         const entry = (await this.histories
             .find({
                 guild: guild,
@@ -375,6 +410,7 @@
     }
 
     async delete(guild: string) {
+        console.log("History delete");
         await this.histories.deleteMany({ guild: guild });
     }
 }
@@ -394,14 +430,17 @@
     }
 
     async read(hash: string) {
+        console.log("ScanCache read");
         return await this.scanCache.findOne({ hash: hash });
     }
 
     async write(hash: string, data: boolean, tags?: string[]) {
-        await this.scanCache.insertOne({ hash: hash, data: data, tags: tags ?? [], addedAt: new Date() });
+        console.log("ScanCache write");
+        await this.scanCache.insertOne({ hash: hash, data: data, tags: tags ?? [], addedAt: new Date() }, collectionOptions);
     }
 
     async cleanup() {
+        console.log("ScanCache cleanup");
         await this.scanCache.deleteMany({ addedAt: { $lt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 31)) }, hash: { $not$text: "http"} });
     }
 }
@@ -414,10 +453,12 @@
     }
 
     async record(data: PerformanceDataSchema) {
+        console.log("PerformanceTest record");
         data.timestamp = new Date();
-        await this.performanceData.insertOne(data);
+        await this.performanceData.insertOne(data, collectionOptions);
     }
     async read() {
+        console.log("PerformanceTest read");
         return await this.performanceData.find({}).toArray();
     }
 }
@@ -441,15 +482,18 @@
     }
 
     async create(guild: string, user: string, note: string | null) {
+        console.log("ModNotes create");
         await this.modNotes.updateOne({ guild: guild, user: user }, { $set: { note: note } }, { upsert: true });
     }
 
     async read(guild: string, user: string) {
+        console.log("ModNotes read");
         const entry = await this.modNotes.findOne({ guild: guild, user: user });
         return entry?.note ?? null;
     }
 
     async delete(guild: string) {
+        console.log("ModNotes delete");
         await this.modNotes.deleteMany({ guild: guild });
     }
 }
@@ -465,20 +509,24 @@
     }
 
     async updateUser(user: string, level: number) {
+        console.log("Premium updateUser");
         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> {
+        console.log("Premium userExists");
         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 });
+        console.log("Premium createUser");
+        await this.premium.insertOne({ user: user, appliesTo: [], level: level }, collectionOptions);
     }
 
     async hasPremium(guild: string): Promise<[boolean, string, number, boolean] | null> {
+        console.log("Premium hasPremium");
         // [Has premium, user giving premium, level, is mod: if given automatically]
         const cached = this.cache.get(guild);
         if (cached && cached[4].getTime() < Date.now()) return [cached[0], cached[1], cached[2], cached[3]];
@@ -518,12 +566,14 @@
     }
 
     async fetchUser(user: string): Promise<PremiumSchema | null> {
+        console.log("Premium fetchUser");
         const entry = await this.premium.findOne({ user: user });
         if (!entry) return null;
         return entry;
     }
 
     async checkAllPremium(member?: GuildMember) {
+        console.log("Premium checkAllPremium");
         const entries = await this.premium.find({}).toArray();
         if(member) {
             const entry = entries.find(e => e.user === member.id);
@@ -577,12 +627,14 @@
     }
 
     async addPremium(user: string, guild: string) {
+        console.log("Premium addPremium");
         const { level } = (await this.fetchUser(user))!;
         this.cache.set(guild, [true, user, level, false, new Date(Date.now() + this.cacheTimeout)]);
         return this.premium.updateOne({ user: user }, { $addToSet: { appliesTo: guild } }, { upsert: true });
     }
 
     removePremium(user: string, guild: string) {
+        console.log("Premium removePremium");
         this.cache.set(guild, [false, "", 0, false, new Date(Date.now() + this.cacheTimeout)]);
         return this.premium.updateOne({ user: user }, { $pull: { appliesTo: guild } });
     }
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 5c461ad..a79a260 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -10,7 +10,7 @@
     constructor() {
         this.agenda = new Agenda({
             db: {
-                address: config.mongoUrl + "Nucleus",
+                address: config.mongoOptions.host,
                 collection: "eventScheduler"
             }
         });
