Fixed the VS build; put a depth limit on the kd-tree construction