   # Define the plugin class
   class InfinitePages
     # Internal id to tracking the elements used for multiple instances
-    @_ID: 0
+    @_INSTANCE_ID: 0
 
     # Internal helper to return a unique id for a new instance for the page
-    @_nextId: ->
-      @_ID += 1
-      @_ID
+    @_nextInstanceId: ->
+      @_INSTANCE_ID += 1
 
     # Default settings
     defaults:

      if typeof @options.loading is 'function'
        @$container.find(@options.navSelector).each(@options.loading)

    _success: ->
      # ignore any requests that started before we last invalidated
      return if @_isInvalidatedRequest(@requestAts.shift())
      @_recache()
      @options.state.loading = false
      @_log "New page loaded!"
      if typeof @options.success is 'function'
        @$container.find(@options.navSelector).each(@options.success)

    _error: ->
      # ignore any requests that started before we last invalidated
      return if @_isInvalidatedRequest(@requestAts.shift())
      @options.state.loading = false
      @_log "Error loading new page :("
      if typeof @options.error is 'function'
        @$container.find(@options.navSelector).each(@options.error)

    # Pause firing of events on scroll
    pause: ->

      else
        @_loading()

        $container = @$container
        @requestAts.push +new Date # note when this request started
        $.getScript(@$container.find(@options.navSelector).attr('href'))
          .done(=> @_success($container))
          .fail(=> @_error($container))

    _loading: ->
      @options.state.loading = true
