     }
     
     func loadState(state: AppState) -> AppState {
-        guard let data = NSData(contentsOfURL: statePersistanceURL),
-            loadedState = AppState(data: data) else {
-                return state
-        }
-
-        return loadedState
+        return AppState(json: defaults.dictionaryRepresentation()) ?? state
     }
     
     func saveState(state: AppState) -> AppState {
-        if let data = state.data {
-            do {
-                try data.writeToURL(statePersistanceURL, options: [])
-            } catch {
-                assertionFailure("Failed to persist JSON")
-            }
-        } else {
-            assertionFailure("JSON is invalid")
-        }
+        let data = state.jsonValue
+        defaults.setValuesForKeysWithDictionary(data)
+        defaults.synchronize()
         return state
     }
 }

        )
    }
    
    var data: NSData? {
        let json = [
            "interval": browser.switchInterval,
            "URLs": browser.tabs.map{ $0.URL.absoluteString }
        ]
        let data = try? NSJSONSerialization.dataWithJSONObject(json, options: [])
        return data
    }
}
// MARK: Persistance

extension BrowserReducer {
    private var defaults: NSUserDefaults {
        return NSUserDefaults.standardUserDefaults()
    }
    private var statePersistanceURL: NSURL {
        let manager = NSFileManager.defaultManager()
        let URL = try! manager.URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: true)
