 
 class root.Lethargy
   constructor: (stability, sensitivity, tolerance) ->
+
+    # Stability is how many records to use to calculate the average
     @stability = if stability? then Math.abs stability else 8
+
+    # The wheelDelta threshold. If an event has a wheelDelta below this value, it will not register
     @sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
+
+    # How much the old rolling average have to differ from the new rolling average for it to be deemed significant
     @tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
+    
+    # Used internally and should not be manipulated
     @lastUpDeltas = (null for [1..(@stability * 2)])
     @lastDownDeltas = (null for [1..(@stability * 2)])
     @deltasTimestamp = (null for [1..(@stability * 2)])
 
+  # Checks whether the mousewheel event is an intent
   check: (e) ->
+    # Use jQuery's e.originalEvent if available
     e = e.originalEvent || e
+
+    # Standardise wheelDelta values for different browsers
     if e.wheelDelta?
       lastDelta = e.wheelDelta
     else if e.deltaY?

    false;

  isInertia: (direction) ->
    lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
    if lastDeltas[0] == null
      return direction
    if @deltasTimestamp[(this.stability * 2) - 2] + 150 > Date.now() and lastDeltas[0] == lastDeltas[(@stability * 2) - 1]
      return false
    lastDeltasOld = lastDeltas.slice(0, @stability)
    lastDeltasNew = lastDeltas.slice(@stability, (@stability * 2))


    else if (e.detail? or e.detail == 0)
      lastDelta = e.detail * -40

    # Add the new event timestamp to deltasTimestamp array, and remove the oldest entry
    @deltasTimestamp.push(Date.now())
    @deltasTimestamp.shift()

    # If lastDelta is positive, it means the user scrolled up
    if (lastDelta > 0)
      @lastUpDeltas.push(lastDelta)
      @lastUpDeltas.shift()
      return @isInertia(1)
    # Otherwise, the user scrolled down
    else
      @lastDownDeltas.push(lastDelta)
      @lastDownDeltas.shift()
