refactor some things to make kd tree stuff less verbose, revisit nn algorithm

i seem to be having trouble with nn + buckets