     let systemObserver: FileSystemSignal
     private let storage: PathStorage = PathStorage()
     
-    // Constants
-    let ImageSize = NSSize(width: 80, height: 80)
-    
     init() {
         
-        self.path = MutableProperty<Path?>(storage.load())
+        self.selection = MutableProperty(storage.load())
         self.label = MutableProperty<String>("Xcode Slices")
-        self.currentPathValid = MutableProperty(false)
+        self.currentSelectionValid = MutableProperty(false)
         self.contentChanged = MutableProperty<Void>()
         self.systemObserver = FileSystemSignal()
 
-        currentPathValid <~ path.producer |> map { $0 != nil }
-        label <~ path.producer |> map { $0?.lastPathComponent ?? "Xcode Slices" }
-        
-        
-        path <~ systemObserver.renameSignal |> map { Optional($0) }
-        path <~ systemObserver.deleteSignal |> map { nil }
-        contentChanged <~ systemObserver.contentChangedSignal |> throttle(0.5, onScheduler: QueueScheduler(priority: 0, name: ""))
-        
-        
-        path.producer
+        currentSelectionValid <~ selection.producer |> map { _ in return self.isCurrentSelectionValid() }
+        label <~ selection.producer |> map { _ in return self.labelForCurrentSelection() }
+        
+//        
+//        path <~ systemObserver.renameSignal |> map { Optional($0) }
+//        path <~ systemObserver.deleteSignal |> map { nil }
+//        contentChanged <~ systemObserver.contentChangedSignal |> throttle(0.5, onScheduler: QueueScheduler(priority: 0, name: ""))
+        
+        
+        selection.producer
             |> observeOn(QueueScheduler(priority: DISPATCH_QUEUE_PRIORITY_LOW, name: "StoreAndObserveQueue"))
-            |> on(next: { path in
-                self.storage.store(path)
-                self.observe(path)
+            |> on(next: { s in
+                self.storage.store(s)
+//                self.observe(path)
             })
             |> start()
     }
     
-    func shouldAcceptPath(path: Path) -> Bool {
-        return isValidPath(path)
-    }
+    func labelForCurrentSelection() -> String {
+        switch selection.value {
+        case .None:
+            return "Xcode Slices"
+        case .Folder(let path):
+            return path.lastPathComponent
+        case .Images(let images):
+            return images.count == 1 ? images[0].lastPathComponent : "Multiple Images"
+        }
+    }
+    
+    func shouldAcceptSelection(paths: [Path]) -> Bool {
+        if paths.count == 1 {
+            return paths.filter { isSupportedImage($0) || self.isValidPath($0) }.count > 0
+        } else {
+            return paths.filter {isSupportedImage($0)}.count > 0
+        }
+    }
+    
+    func acceptableItemsOfSelection(path: [Path]) -> Int {
+        if path.count == 1 {
+            return 1
+        }
+        return path.filter(isSupportedImage).count
+    }
+    
+    func assetRepresentation() -> [Asset] {
+        switch selection.value {
+        case .None:
+            return []
+        case .Images(let images):
+            return images.map { Asset(fullPath: $0, ancestor: $0.stringByDeletingLastPathComponent) }
+        case .Folder(let folder):
+            return PathQuery.availableImages(from: folder).map { Asset(fullPath: $0, ancestor: folder) }
+        }
+    }
+
     
     private func isValidPath(path: Path) -> Bool {
         return PathValidator.directoryExists(path: path) && !path.isXCProject()

        }
    }
    
    func newPathSelected(path: Path) {
        self.path.put(path + "/")
    }
    
    func isCurrentPathValid() -> Bool {
        if let path = path.value {
            return isValidPath(path)
        } else {
            return false
        }
    }
    
    func systemImageForCurrentPath() -> NSImage {
        return NSImage.systemImage(path.value!, size: ImageSize)
    }
    
    struct PathStorage {
        func store(path: Path?) {
            if let path = path {
                NSUserDefaults.standardUserDefaults().setObject(path, forKey: "ImagesFolderWuzHere")
            } else {
                NSUserDefaults.standardUserDefaults().removeObjectForKey("ImagesFolderWuzHere")
            }

        }
        
        func load() -> Path? {
            let value = NSUserDefaults.standardUserDefaults().objectForKey("ImagesFolderWuzHere") as? Path
            store(value)
            return value
            
            // Make sure the current selected project is valid and adjust the selection state accordingly.
            // Filter out invalid/corrupted projects

import Foundation
import ReactiveCocoa

enum ImageSelection: Printable, Serializable {
    case Images([Path])
    case Folder(Path)
    case None
    
    static func create(path: Path) -> ImageSelection {
        return isSupportedImage(path) ? .Images([path]) : PathValidator.directoryExists(path: path) ? .Folder(path) : .None
    }
    
    static func create(paths: [Path]) -> ImageSelection {
        if paths.count == 1 {
            return create(paths[0])
        }
        let acceptable = paths.filter(isSupportedImage)
        return acceptable.count > 0 ? .Images(acceptable) : .None
    }
    
    func asAssets() -> [Asset] {
        switch self {
        case .None:
            return []
        case .Images(let images):
            return images.map { Asset(fullPath: $0, ancestor: $0.stringByDeletingLastPathComponent) }
        case .Folder(let folder):
            return PathQuery.availableImages(from: folder).map { Asset(fullPath: $0, ancestor: folder) }
        }
    }
    
    var description: String {
        switch self {
        case .None:
            return "None:"
        case .Images(let path):
            return "Image: \(path)"
        case .Folder(let folder):
            return "Folder: \(folder)"
        }
    }
    
    typealias Serialized = [Bookmark]?
    
    var serialized: Serialized {
        switch self {
        case .None:
            return nil
        case .Images(let i):
            return i.map(BookmarkResolver.resolveBookmarkFromPath)
        case .Folder(let f):
            return [BookmarkResolver.resolveBookmarkFromPath(f)]
        }
    }
    
    static func deserialize(serial: Serialized) -> ImageSelection {
        if let s = serial {
            let paths = s.map(BookmarkResolver.resolvePathFromBookmark).filter { $0 != nil }.map{ $0! } as [Path]
            return create(paths)
        } else {
            return .None
        }
    }
    
}

// RAC3 TODO: Remove NSObject

class ImagesGroupViewModel {
    private let selection: MutableProperty<ImageSelection>
    let label: MutableProperty<String>
    let currentSelectionValid: MutableProperty<Bool>
    
    private let contentChanged: MutableProperty<Void>
    // let image
    // let colors
    
    var selectionSignal: SignalProducer<ImageSelection, NoError> {
        return selection.producer
    }
    var contentSignal: SignalProducer<Void, NoError> {
        return contentChanged.producer
