reverted kdtree.py