     }
 }
 
-fileprivate var localCache: [Int: [Int: URL]] = [:]
 
+private var localCache: [Int: [Int: URL]] = [:]
 extension UIImageView {
 
     func setArtwork(of artwork: Track, size width: CGFloat) {

    }
}

fileprivate struct UIImageViewKey {
    static var itm_imageURL: UInt8 = 0
}

        guard doOnMainThread(execute: self._setArtwork(id: id, generator: generator, size: width)) else {
            return
        }
        let size = { Int($0 * UIScreen.main.scale) }

        let thumbnailURL = generator(size(width / 2))
        let artworkURL = generator(size(width))

        var imageURLs: [(size: Int, url: URL)] = [(size(width / 2), thumbnailURL), (size(width), artworkURL)]
        let isNotContained = { !imageURLs.lazy.map { $1 }.contains($0) }

        if let (key, cachedURL) = localCache[id]?.lazy.sorted(by: { $0.key > $1.key }).first, isNotContained(cachedURL) {
            imageURLs.insert((key, cachedURL), at: 0)
        }

        if itm_imageURL.map(isNotContained) ?? false {
            image = nil
            setNeedsLayout()
        }

        func setImage(from urls: ArraySlice<(size: Int, url: URL)>, placeholder: UIImage? = nil) {
            guard !urls.isEmpty else { return }
            var urls = urls
            let (size, url) = urls[urls.startIndex]
            itm_imageURL = url
            pin_setImage(from: url, placeholderImage: placeholder) { [weak self] result in
                if result.image != nil {
                    var cache = localCache.removeValue(forKey: id) ?? [:]
                    cache[size] = url
                    localCache[id] = cache
                }
                DispatchQueue.main.async {
                    if url == self?.itm_imageURL {
                        setImage(from: urls.dropFirst(), placeholder: result.image)
                    }
                }
            }
        }
        setImage(from: ArraySlice(imageURLs))
    }
}
