   #
   # In the leaf page file, a record is stored as JSON string. The objects are
   # loaded from the file as needed, or else when the opportunity presents
-  # itself. The leaf page keeps a [map](#map) that maps file positions to
-  # deserialized JSON objects.
+  # itself. The leaf page keeps a map (a JavaScript `Object`) that maps file
+  # positions to deserialized records.
   #
   # Because the records are sorted, and because a lookup takes constant time, we
   # can search for a record in a leaf page using binary search in logorithmic
   # time.
+  #
+  # #### No Duplicates
   #
   # Leaf pages cannot contain duplicate records. Therefore, the b&#x2011;tree cannot
   # contain duplicate records. You can simulate duplicate records by adding a
   # series value to your key. The cursor implementation is designed faciliate
   # psuedo-duplicates in this fashion.
   #
+  # #### Leaf Page Key
+  #
   # The first record of every leaf page is the key value of the leaf page.
   #
   # When we delete records from the leaf page, if we delete the first reord, we
   # keep a ghost of the record around, so we will know the key value of the leaf
   # page.
   #
-  # If a leaf page exceeds the leaf order, the leaf page is split.
+  # #### Leaf Page Split
+  #
+  # If the record count of leaf page exceeds the leaf order, the leaf page is split.
 
   # The in memory representation of the leaf page includes a flag to indicate
   # that the page is leaf page, the address of the leaf page, the page address


    page.size += size
    @size += size

  # We have to cache the calcuated size of the record because we return the
  # records to the client. We're not strict about ownership. The client may
  # decide to alter the object we returned. We need to cache the JSON size and
  # the key value when we load the object.
  cacheRecord: (page, position, record) ->
    key = @extractor record

    size = 0
    size += JSON.stringify(record).length
    size += JSON.stringify(key).length

    entry = page.cache[position] = { record, key, size }

    page.size += size
    @size += size

    entry

  # When we purge the record, we add the position length. We will only ever
  # delete a record that has been cached, so we do not have to create a function

    extend page, override or {}

  # #### Leaf Page JSON Size
  #
  # JSON size is used as a fuzzy measure of the in&#x2011;memory size of a leaf page.

  # #### Cached JSON Page Size

  # We have to cache the calcuated size of the record because we return the
  # records to the client.  We need to cache the JSON size and the key value
  # when we load the object so we can deduct the proper amount from the page
  # size and total size when we delete a record. We can't recalculate because
  # we're not strict about ownership. The application programmer may decide to
  # alter the object we returned.
  cacheRecord: (page, position, record) ->
    key = @extractor record

    size = 0
    size += JSON.stringify(record).length
    size += JSON.stringify(key).length

    entry = page.cache[position] = { record, key, size }

    page.size += size
    @size += size

    entry

  # We do not include the position size in the cached size because it is simple
  # to calculate and the client cannot alter it.
