finished BST api