removed explicit NULL compares to make code more portable
added balanced insert to RBT