Some refactoring of Set and BinarySearchTree to make the code more pleasant to read.