       }
     }
 
+    this.waitingForApi = true
     responseProcessor = (data) ->
+      console.log "AnnotationDocumentManager: loaded new annotation document (id: #{data[0].id})"
       _this.documentStore.push annotationDocument for annotationDocument in data
+      _this.waitingForApi = false
     this.apiCall requestOptions, responseProcessor, postUpdateCallback
 
   next: ->

      async: _this.asynchronousRequest,
      success: (data) ->
        responseProcessor(data) if responseProcessor
        postUpdateCallback _this.next() if postUpdateCallback
      error: (a, b, c) ->
        console.log "error requesting the annotation documents API " +
                    "(#{b} #{a.status}; #{c}) - request options & jqXHR:"

    this.maxAnnotationDocumentsToLoad = 1
    this.apiVersion = 'v1'
    this.asynchronousRequest = !synchronousRequest
    this.waitingForApi = false
    this.requestNextDocumentCallback = undefined

    this.initAjax()
    this.loadAnnotationDocuments()

  # external API:

  requestNextDocumentPayload: (calleeCallback) ->
    if this.waitingForApi
      # hook into a running request if one if being processed right now
      _this.requestNextDocumentCallback = calleeCallback
      return true

    else unless this.currentDocument
      # no annotation document is currently being processed
      nextDocument = this.next()

      # an annotation document is already preloaded
      calleeCallback(nextDocument) if nextDocument

      # request a new annotation document if none was preloaded
      this.loadAnnotationDocuments calleeCallback unless nextDocument
      return true
    false
