Implemented BallTree