first version of kdtree
minor changes