clean code for BST