 
   init = (cb) ->
     loadRoutes () ->
-      loadData () ->
-        cb() if cb?
+      cb() if cb?
 
 
   parseConfigLine = (line) ->

        log.DEBUG "including yaml file #{path}"
        yaml_data = fs.readFileSync path, 'utf8'
        return yaml.load(yaml_data)
      data_ = yaml.load(datafile)
      log.DEBUG 'loaded data: ' + util.inspect data_
      cb() if cb?
    catch except
      log.FATAL 'cannot load data file: ' + except
  

  getData = (jpath, cb) ->
    ###
    Retrieves data matching a given jsonpath.
    Callbacks when complete with the matched object(s) and the entire data file
    contents as context.
    ###

    try
      context = data_
      matched = context
      if jpath == '$'
        if not (matched instanceof Array)

      log.DEBUG "url #{parsedUrl.pathname} not matched"
      next()
      return
    loadData (err, data) ->
      if err?
        next httpError 500, err.message
      if not matched.jpath?
        send matched, {}, data, req, res, next
      else
        getData data, matched.jpath, (err, obj, context) ->
          if err?
            next httpError 500, err.message
            return
          switch matched.cond
            when ROUTE_COND_ONE
              if obj.length != 1
                log.DEBUG "route condition 'one' not satisfied"
                next()
                return
              obj = obj[0]
            when ROUTE_COND_MULTI
              if obj.length < 1
                log.DEBUG "route condition 'multi' not satisfied"
                next()
            when ROUTE_COND_ALL
            else
              obj = obj[0]
          send matched, obj, context, req, res, next

  init(cb)
  return processRequest
