             
             Meow.log("Unpooling \(instance)")
             
-            objectPoolMutationQueue.sync {
-                storage[instance._id] = nil
-                
-                // remove if invalidated to free up memory:
-                invalidatedObjectIds.remove(instance._id)
-            }
+            storage[instance._id] = nil
+            
+            // remove if invalidated to free up memory:
+            invalidatedObjectIds.remove(instance._id)
         }
         
         /// The amount of pooled objects
         public var count: Int {
+            objectPoolMutationLock.lock()
+            defer { objectPoolMutationLock.unlock() }
+            
             self.clean()
-            return objectPoolMutationQueue.sync {
-                return storage.count
-            }
+            return storage.count
         }
         
         /// Removes deallocated entries from the pool
         @discardableResult
         public func clean() -> Int {
-            return objectPoolMutationQueue.sync {
-                var cleanedCount = 0
-                
-                for (id, val) in storage {
-                    if val.instance.value == nil {
-                        storage[id] = nil
-                        cleanedCount += 1
+            objectPoolMutationLock.lock()
+            defer { objectPoolMutationLock.unlock() }
+            
+            var cleanedCount = 0
+            
+            for (id, val) in storage {
+                if val.instance.value == nil {
+                    storage[id] = nil
+                    cleanedCount += 1
+                }
+            }
+            
+            return cleanedCount
+        }
+        
+        /// Handles automatically saving models so they don't get lost when the server randomly crashes/shuts down
+        fileprivate func maintenance() {
+            objectPoolMutationLock.lock()
+            let oldObjects = storage.filter({ $0.value.instantiation.timeIntervalSinceNow < -(minimumAutosaveAge) })
+            objectPoolMutationLock.unlock()
+            
+            for (_, val) in oldObjects {
+//                Meow.maintenanceQueue.async {
+                    do {
+                        try (val.instance.value as? BaseModel)?.save()
+                    } catch {
+                        Meow.log("❗ Error while performing autosave")
+                        Meow.log(error)
+                        assertionFailure("\(error)")
                     }
-                }
-                
-                return cleanedCount
-            }
-        }
-        
-        /// Handles automatically saving models so they don't get lost when the server randomly crashes/shuts down
-        fileprivate func autoSave() throws {
-            let oldObjects = objectPoolMutationQueue.sync {
-                return storage.filter({ $0.value.instantiation.timeIntervalSinceNow < -(minimumAutosaveAge) })
-            }
-            
-            for (_, val) in oldObjects {
-                try (val.instance.value as? BaseModel)?.save()
+//                }
             }
         }
     }

                throw Error.missingOrInvalidValue(key: "_id", expected: ObjectId.self, got: document["_id"])
            }
            
            var existingInstance: M?
            
            objectPoolMutationQueue.sync {
                existingInstance = storage[id]?.instance.value as? M
            }
            
            if let existingInstance = existingInstance {
                Meow.log("Returning \(existingInstance) from pool")
                return existingInstance
            }
            
            let instantiation: RunningInstantiation = try objectPoolMutationQueue.sync {
                let instantiation = currentlyInstantiating[id]
                guard instantiation == nil || instantiation!.thread != Thread.current else {
                    throw Meow.Error.infiniteReferenceLoop(type: M.self, id: id)

            }
        }
        
        /// The lock used to prevent crashes in mutations
        private var objectPoolMutationLock = NSRecursiveLock()
        
        fileprivate init() {
            // Save the database contents before exiting
