 # Branch pages contain links to other pages, and do not store records
 # themselves.
 #
-# Leaf pages are linked in ascending order for traversal by cursors. Branch
-# pages are singly linked in ascending order to simplify implementation of
-# branch page merges.
+# Leaf pages are linked in ascending order to simply the implementatoin of
+# traversal by cursors. Branch pages are singly linked in ascending order to
+# simplify implementation of branch page merges.
 #
 # The order of a branch page is the maximum number of children for a branch
 # page. The order of a leaf page is maximum number of records for a leaf page.

# sibling pages next to each other can be combined to create a page less than
# than the order they are merged.
#
# The b&#x2011;tree always has a root branch page. The order of the tree increases when
# the root branch page is split. It decreases when the root branch page is
# merged. The split of the root branch is a different operation from the split
# of a non-root branch, because the root branch does not have siblings.

# Requried node.js libraries.
fs = require "fs"

# comparator. The extractor is used to extract a key from the stored record. The
# comparator is used to order records by comparing the key.
#
# Separating extraction from comparison allows us to cache the key. We do not
# need the whole record for comparison, only the key. Keys are used to order the
# tree, so when we will constantly be reading records off the disk solely to get
# their key value.
#
# If a record is read for its key, but the record is not soon visited by a
# cursor, it will eventually be collected by a cache purge, while the key will
# be retained, if the key is frequently consulted by queries as they descend the
# tree. If the key is subset of a large record, purging the records and
# retaining the keys will reduce the in&#x2011;memory size of the b&#x2011;tree.
#
# Also, the comparator is pretty easily generalized, while the exractor is
# invariably specialized. You might have a single string comparator that you use
# with extractors specialized for different types of records.
#
# ### Default Collation
#
# You will almost certainly define your down extractors and comparators, but the
# b&#x2011;tree has a default that works for b&#x2011;tree that stores only
# JavaScript primitives.

# Default comparator is good only for strings, use a - b for numbers.
comparator = (a, b) ->
