 # Model for a single user task.
 class Task
   # Creates a task with default values.
-  constructor: ->
-    @name = null
-    @done = false
-
-  # Reads data about a task from the stat of is file in a user's Dropbox.
-  #
-  # @param {Dropbox.Stat} entry the directory entry representing the task
-  fromStat: (entry) ->
-    @name = entry.name
-    @done = entry.path.split('/', 3)[1] is 'done'
-    @
-
-  # Cleans up the task name so that it's valid Dropbox file name.
-  cleanupName: (name) ->
+  constructor: (properties) ->
+    @name = properties?.name or '(no name)'
+    @done = properties?.done or false
     # English-only hack that removes slashes from the task name.
     @name = @name.replace(/\ \/\ /g, ' or ').replace(/\//g, ' or ')
-    @
+
+  # Creates a Task from the stat of its file in a user's Dropbox.
+  #
+  # @param {Dropbox.Stat} entry the directory entry representing the task
+  # @return {Task} the newly created task
+  @fromStat: (entry) ->
+    new Task name: entry.name, done: entry.path.split('/', 3)[1] is 'done'
 
   # Path to the file representing the task in the user's Dropbox.
   # @return {String} fully-qualified path

    @renderTask(task) for task in @tasks.active
    @renderTask(task) for task in @tasks.done

  # Renders a task into the
  renderTask: (task) ->
    $list = if task.done then @$doneList else @$activeList
    $list.append @$taskDom(task)

  # @param {function()} done called when the task is saved to the user's
  #     Dropbox
  addTask: (task, done) ->
    @dbClient.writeFile task.path(), '', (error, stat) =>
      return @showError(error) if error
      @addTaskToModel task
