         
         return nil
     }
-
-    // TODO: this should be T: StorableDefaultType when we get actual types
-    func toJSON<T>(object: T) -> AnyObject? {
-        return object as? AnyObject
-    }
-    
-    func toJSON<T: Storable>(object: T) -> AnyObject? {
-        let mirror = Mirror(reflecting: object)
-        
-        if mirror.children.count > 0 {
-            var result = Dictionary<String, AnyObject>()
-            
-            for (key, value) in mirror.children {
-                if let value = value as? AnyObject {
-                    if value is Storable {
-                        // TODO: figure out how to get value as the actual struct type
-                    } else {
-                        // TODO: replace with switch to get actual type
-                        result[key!] = self.toJSON(value)
-                    }
-                    
-                    // we can check that these are Storable or StorableDefaultType
-                    // but we can't cast them as such to send them to toJSON?
-//                    if value is StorableDefaultType {
-//                        switch (value) {
-//                        case let intValue as Int:
-//                            result[key!] = self.toJSON(value as! Int)
-//                        case let floatValue as Float:
-//                            result[key!] = self.toJSON(value as! Float)
-//                        case let stringValue as String:
-//                            result[key!] = self.toJSON(value as! String)
-//                        default:
-//                            break
-//                        }
-//                    } else if value is [StorableDefaultType] {
-//                        switch (value) {
-//                        case let intValue as Int:
-//                            result[key!] = self.toJSON(value as! [Int])
-//                        case let floatValue as Float:
-//                            result[key!] = self.toJSON(value as! [Float])
-//                        case let stringValue as String:
-//                            result[key!] = self.toJSON(value as! [String])
-//                        default:
-//                            break
-//                        }
-//                    }
-                }
-            }
-            
-            return result
-        } else {
-            return object as? AnyObject
-        }
-    }
-    
-    func toJSON<T: Storable>(objects: [T]) -> AnyObject? {
-        var subobject = [AnyObject]()
-        for item in objects {
-            if let itemInJSON = self.toJSON(item) {
-                subobject.append(itemInJSON)
-            }
-        }
-        
-        return subobject as AnyObject
-    }
-    
-    func toJSON<T: StorableDefaultType>(objects: [T]) -> AnyObject? {
-        var subobject = [AnyObject]()
-        for item in objects {
-            if let itemInJSON = self.toJSON(item) {
-                subobject.append(itemInJSON)
-            }
-        }
-        
-        return subobject as AnyObject
-    }
-
     
     func write(object: AnyObject) {
         let cacheLocation = cacheFileURL()
-        var storableDictionary = Dictionary<String, AnyObject>()
+        var storableDictionary = [String: AnyObject]()
         
         storableDictionary["storage"] = object
+        print("attempting to write",storableDictionary)
         
         let success = (storableDictionary as NSDictionary).writeToURL(cacheLocation, atomically: true)
-        //        print("wrote to",cacheLocation)
         print("writing",success)
     }
     

    static func pack<T: Storable>(object: T, key: String) {
        let warehouse = JSONWarehouse(key: key)
        
        if let json = warehouse.toJSON(object) {
            warehouse.write(json)
        }
    }
    
    static func pack<T: Storable>(objects: [T], key: String) {
        let warehouse = JSONWarehouse(key: key)
        
        if let json = warehouse.toJSON(objects) {
            warehouse.write(json)
        }
    }
    
    static func pack<T: StorableDefaultType>(object: T, key: String) {
        let warehouse = JSONWarehouse(key: key)
        
        if let json = warehouse.toJSON(object) {
            warehouse.write(json)
        }
    }

    static func pack<T: StorableDefaultType>(objects: [T], key: String) {
        let warehouse = JSONWarehouse(key: key)
        
        if let json = warehouse.toJSON(objects) {
            warehouse.write(json)
        }
    }

    // MARK: unpack generics
    


// MARK: default types that are supported

public protocol StorableDefaultType {
}

extension String: StorableDefaultType { }
extension Int: StorableDefaultType { }
extension Float: StorableDefaultType { }

// MARK: warehouse is a thing that serializes and deserializes data

