added lots of debug write statements
first variation that appears to be working rb tree
full working rb tree
remove commented-out code