add kdtree implementation