     }
     
     private func data(forKey key:String) -> Data? {
-        
-        // The lock prevents the code to be run simultaneously
-        // from multiple threads which may result in crashing
-        lock.lock()
-        defer { lock.unlock() }
-        
+
         let hierKey = hierarchicalKey(key)
         let query = self.query()
         query.setObject(hierKey, forKey: kSecAttrService as! NSCopying)

    // MARK: Private functions to do all the work
    
    private func set(_ data: NSData?, key: String, accessibility: CFString = kSecAttrAccessibleWhenUnlocked) -> Bool {
        
         // The lock prevents the code to be run simultaneously
         // from multiple threads which may result in crashing
        lock.lock()
        defer { lock.unlock() }
        
        let hierKey = hierarchicalKey(key)

        let dict = service()

     */
    public func archive(_ object: Any?, key: String, accessibility: CFString = kSecAttrAccessibleWhenUnlocked) -> Bool
    {
        // The lock prevents the code to be run simultaneously
        // from multiple threads which may result in crashing
        lock.lock()
        defer { lock.unlock() }
        
        guard let _=object as? NSSecureCoding else {
            // The optional is empty, so remove the key
            return remove(key: key, accessibility: accessibility)
