refactored bst tree validator