 
   updateFileList:(newname)->
 
+    @loadExamples()
     prevFile = newname ? @fileList.first?.data?.name
+
     @storage.filter /file\-/, (files)=>
+
       @fileList.replaceAllItems files
-
-      if files.length is 0
-        @coffeeEditor.openFile file = @createNewFile()
-        return @updateFileList file
 
       if prevFile
         for item in @fileList.itemsOrdered
           if item.data.name is prevFile
             @fileList.selectItem item
+      else
+        @fileList.selectItem @fileList.itemsOrdered.last
 
 
   runJsCode:->

  attachListeners:->

    @fileListView.on 'removeItem', (item)=>
      @storage.unsetKey item.data.name
      @updateFileList()



    @storage.getValue "lastFile", (file)=>

      @coffeeEditor.openFile file  if file?

      @fileList.on 'ItemSelectionPerformed', (..., {items})=>

        if @coffeeEditor.fileName?
          @coffeeEditor.handleSave yes

        @coffeeEditor.openFile items.first.data.name

      @updateFileList file

  toggleHelpMode:->

