 open class LevelDB {
     public let serialQueue = DispatchQueue(label: "org.amr.leveldb")
     
-    var path: String
-    var name: String
+    public var parentPath = ""
+    public var name = "Database"
 	public var dictionaryEncoder: (String, [String : Any]) -> Data?
     public var dictionaryDecoder: (String, Data) -> [String : Any]?
     public var encoder: (String, Data) -> Data?
     public var decoder: (String, Data) -> Data?
     public var db: UnsafeMutableRawPointer?
     
+    var dbPath: String {
+        return parentPath + "/" + name
+    }
+    
     // MARK: - Life cycle
+    
     
     required public init(parentPath: String, name: String) {
         //NSLog("LevelDB init")
+        self.parentPath = parentPath
         self.name = name
         //NSLog("LevelDB self.name: \(name)")
-        self.path = parentPath + "/" + name
+        //self.path = parentPath + "/" + name
         //NSLog("LevelDB path: \(path)")
         self.dictionaryEncoder = { key, value in
             #if DEBUG

    // MARK: - Accessors
    
    open func description() -> String {
        return "<LevelDB:\(self) path: \(path)>"
    }
    
    open func setValue<T: Codable>(_ value: T, forKey key: String) {

    
    // MARK: - Helper methods
    
    public func backupIfNeeded() {
        let dbBackupPath = dbPath + "1"
        serialQueue.async {
            let fileManager = FileManager.default
            let dbTempPath = dbBackupPath + ".temp"
            do {
                //logger.log("dbPath: \(dbPath)")
                try fileManager.copyItem(atPath: self.dbPath, toPath: dbTempPath)
            }
            catch {
            }
            do {
                try fileManager.removeItem(atPath: dbBackupPath)
            }
            catch {
            }
            do {
                try fileManager.moveItem(atPath: dbTempPath, toPath: dbBackupPath)
            }
            catch {
            }
        }
    }
    
    open func deleteDatabaseFromDisk() {
        self.close()
        serialQueue.smartSync {
            do {
                let fileManager = FileManager.default
                try fileManager.removeItem(atPath: dbPath)
            } catch {
                NSLog("error deleting database at dbPath \(dbPath), \(error)")
            }
        }
    }
    
    public func open() {
        serialQueue.smartSync {
            self.db = levelDBOpen(dbPath.cString)
        }
    }
    
