     contentItems = @items
       .filter (x) ->
         queries
-          .map (q) -> q.test(x.filetext) || q.test(x.test)
+          .map (q) -> q.test(x.filetext) || q.test(x.title)
           .reduce (x, y) -> x && y
     return contentItems
+
+  getSubPath: (baseDir, dir)->
+    ret = []
+    fullDir = path.join(baseDir, dir)
+    for filename in fs.readdirSync(fullDir)
+      filePath = path.join(dir, filename)
+      fullPath = path.join(baseDir, filePath)
+      if fs.statSync(fullPath).isDirectory()
+        ret = ret.concat(@getSubPath(baseDir, filePath))
+      else
+        if !fsPlus.isMarkdownExtension(path.extname(filename))
+          continue
+        ret.push(filePath)
+    return ret
 
   loadData: ->
     @data = []
 
-    directory = atom.config.get('notational-velocity.directory')
+    basedir = atom.config.get('notational-velocity.directory')
 
-    for filename in fs.readdirSync(directory)
-      if !fsPlus.isMarkdownExtension(path.extname(filename))
-        continue
-
-      filepath = path.join(directory, filename)
-      filetext = fs.readFileSync(filepath, 'utf8')
-      modified = fs.statSync(filepath).mtime
-
-      title = ''
-      result = filetext.match(/^#\s.+/)
-      if result != null
-        title = result[0].slice(2, result[0].length)
+    for filepath in @getSubPath(basedir, '')
+      fullpath = path.join(basedir, filepath)
+      filename = path.basename(filepath, path.extname(filepath))
+      filetext = fs.readFileSync(fullpath, 'utf8')
+      title = path.join(path.dirname(filepath), filename)
+      modified = fs.statSync(fullpath).mtime
 
       item = {
         'title': title,
         'modified': modified,
         'filetext': filetext,
         'filename': filename,
-        'filepath': filepath
+        'filepath': fullpath
       }
       @data.push(item)
+
+    @data = @data.sort (x, y) -> if x.modified.getTime() <= y.modified.getTime() then 1 else -1
 
     @setItems(@data)
 

    @panel?.hide()

  populateList: ->
    console.log 'populateList'
    return unless @items?

    filterQuery = @getFilterQuery()

      @confirmed(item)
    else
      query = @getFilterQuery()
      @cancel()

  confirmed: (item) ->
    atom.workspace.open(item.filepath)
    @cancel()

  destroy: ->
    @cancel()
    @panel?.destroy()

  show: ->
    @storeFocusedElement()
    @panel ?= atom.workspace.addModalPanel(item: this)
    @panel.show()
