Sorted dict 1

Pull request for SortedDict and BalancedTree23 taking into account Kevin Squire's feedback from the past 12 days.
(Given its use, it's not really that important, but the fact that the last calculated value of a function is returned is worth remembering.)