   'hbs!templates/workspace/content/search-results'
 ], ($, _, Backbone, Marionette, SearchResultsItemView, searchView, searchResultsTemplate) ->
 
+
+  # Delay Sorting.
+  # When a title is changed multiple `change` events are fired and
+  # if the collection is large then calling `allContent.sort()` takes a long time.
   SORT_TIMEOUT = 250 # milliseconds
 
+  # Sorts `allContent` by lastModified, mediaType, and then by title.
+  # This is attached to `allContent` when the view is initialized.
+  #
+  # Reasons for including here instead of on `allContent` directly:
+  #
+  # - Other implementations of `allContent` would need to copy-pasta this
+  # - Other comparators (sort by Title) will probably be added soon
+  # - This is the only code that relies on `allContent` being sorted
+  #
+  # See `Backbone.Collection.comparator`
   SORT_COMPARATOR = (modelA, modelB) ->
     compareAttribute = (name, desc=false) ->
       valueA = modelA.get(name)

           compareAttribute('title') or
           compareAttribute('id')

  return class SearchResultsView extends Marionette.CompositeView
    template: searchResultsTemplate
    itemViewContainer: 'tbody'

            @sorting = false
            ), SORT_TIMEOUT

      # When a sort happens, instead of re-rendering all the children,
      # just reorder the DOM.
      #
      # When a sort event is fired it is guaranteed no other models were
      # added or removed.
      @listenTo @collection, 'sort', () => @reorder()


