   clever = require("./index") api_key, "localhost"
 
   trequire = (fp) ->
-    val = null
+    val = []
     if fs.existsSync("#{fp}.coffee") or fs.existsSync("#{fp}.js") or fs.existsSync("#{fp}.json")
       try
         val = require(fp)
       catch err
         throw new Error "Error loading file at #{fp}: #{err}"
-    return val or []
+    val
 
+  # clever.db[resource] are arrays of resources
   clever.db =
     districts: trequire("#{data_dir}/districts")
     districtproperties: trequire("#{data_dir}/districtproperties")

_.mixin require('underscore.string').exports()
_.mixin require('underscore.deep')

module.exports = (api_key, data_dir) ->
  throw new Error "Must provide api_key" unless api_key?
  throw new Error "Must provide data_dir" unless data_dir?

    resource = @constructor.name.toLowerCase() + 's'
    resource_singular = _(resource).rtrim('s')
    id = @_properties.id
    clever_resource = clever.map[resource][id]
    return setImmediate cb(new Error("404")) unless clever_resource?
    resource_property = "#{resource_singular}properties"
    prop_obj = clever.map[resource_property][id]
    if not prop_obj
      prop_obj = _.object [[resource_singular, id], ['data', {}]]
      clever.db[resource_property].push prop_obj
      clever.map[resource_property][id] = prop_obj
    if obj
      dotty.put prop_obj.data, k, v for k, v of obj
      if obj.google_apps?.username?
