Implement the essentials of the range tree data structure.

Minor fixes to other areas of the code to prepare for range tree
testing.