first step toward refactoring
factor out binary tree code
Streamline KDE dual tree