 public class SQPool {
     
     private let path: String?
-    private let flags = SQDatabase.Flags.ReadWriteCreate
-    private var useID = 0
-    private var connPool: [SQDatabase] = []
+    private var connIndex = 1
+    private let flags = SQDatabase.Flag.ReadWriteCreate
+    private var connPool: [Int:SQDatabase] = [:]
     private var inUsePool: [Int:SQDatabase] = [:]
     
     // Queue for database write operations

        return status
    }
    
    public func write(closure: (SQDatabase)->Void) {
        let (index, db) = getConnection()
        dispatch_sync(writeQueue, {

        releaseConnection(index)
    }
    
    public func writeAsync(closure: (SQDatabase)->Void) {
        dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), {self.write(closure)})
    }
    
    public func read(closure: (SQDatabase)->Void) {
        let (index, db) = getConnection()
        closure(db)
        releaseConnection(index)
    }
    
    public func readAsync(closure: (SQDatabase)->Void) {
        dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), {self.read(closure)})
    }
    
}
