Implements BST and some handy methods