   ###
 
   writeSync: (options) ->
+
+    # require handle
     throw new Error 'No handle' unless @handle
+
+    # call native method
     @handle.write @self, options
+
+    # clear batch
     @self.clear()
-    @
+
+    @ # return this for chaining
 
 
   ###

  ###

  write: (options, callback) ->
    throw new Error 'No handle' unless @handle

    if typeof options is 'function'
      callback = options
      options = null

    @handle.write @self, options, (err) =>
      @self.clear() unless err
      if callback
        callback err
      else if err
        throw err
    @


  ###


exports.Batch = class Batch

  noop = (err) -> throw err if err


  ###

