     edit: ->
       @$el.addClass 'editing'
       @input.focus()
-      return
     close: ->
       value = @input.val().trim()
       if value
-        @model.save title: value, { patch: true }
+        @model.save title: value
       @$el.removeClass 'editing'
-      return
     updateOnEnter: (e) ->
       if e.which == 13
         @close()
-      return
     toggleCompleted: ->
       @model.toggle()
-      return
     destroy: ->
       @model.destroy()
-      return
   )
   # renders the full list of todo items calling TodoView for each one.
   app.AppView = Backbone.View.extend(
     el: '#todoapp'
     initialize: ->
       @input = @$('#new-todo')
-      app.todoList.on 'add', @addAll, this
+      app.todoList.on 'add', @addOne, this
       app.todoList.on 'reset', @addAll, this
-      app.todoList.fetch(reset: true)
-      # console.log @$el
-      # Loads list from local storage
-      return
+      app.todoList.fetch()
     events: 
       'keypress #new-todo': 'createTodoOnEnter'
     createTodoOnEnter: (e) ->
-      if e.which != 13 or !@input.val().trim()
-        # ENTER_KEY = 13
-        return
+      return if e.which != 13 or !@input.val().trim() # ENTER_KEY = 13
       app.todoList.create @newAttributes()
       @input.val ''
-      # clean input box
-      return
     addOne: (todo) ->
       view = new (app.TodoView)(model: todo)
       $('#todo-list').append view.render().el
-      return
     addAll: ->
       @$('#todo-list').html ''
-      app.todoList.each @addOne, this
-      # clean the todo list
-      # filter todo item list
-      # switch window.filter
-      #   when 'pending'
-      #     _.each app.todoList.remaining(), @addOne
-      #   when 'completed'
-      #     _.each app.todoList.completed(), @addOne
-      #   else
-      #     app.todoList.each @addOne, this
-      #     break
-      return
+      switch window.filter
+        when 'pending'
+          _.each app.todoList.remaining(), @addOne
+        when 'completed'
+          _.each app.todoList.completed(), @addOne
+        else
+          app.todoList.each @addOne, this
+          break
     newAttributes: ->
       {
         title: @input.val().trim()

  #--------------
  # Routers
  #--------------
  # app.Router = Backbone.Router.extend(
  #   routes: '*filter': 'setFilter'
  #   setFilter: (params) ->
  #     console.log 'app.router.params = ' + params
  #     # window.filter = params.trim() or ''
  #     app.todoList.trigger 'reset'
  #     return
  # )
  #--------------
  # Initializers
  #--------------   
  #app.router = new (app.Router)
  #Backbone.history.start()
  app.appView = new (app.AppView)

$(document).ready(ready)

  #--------------
  # Views
  #--------------
  app.TodoView = Backbone.View.extend(
    tagName: 'li'
    template: _.template('<div class="view">
        <input class="toggle" type="checkbox" <%= completed ? "checked" : "" %>>
        <label><%- title %></label>
