private void findParent(double[] target, KDNode node, int d) {		
		// IF the node would be inserted in the branch "below" this node.
		if(target[d] < node.values[d]){
			if (++d == dimensionCount) {
				d = 0;
			}
			if(node.below == null){
				nearestNeighboor = node.values;
				minDist = distance(node.values, target);
				return;
			}
			findParent(target, node.below, d);
		}
		
		//  IF the node would be inserted in the branch "above" this node.
		if(++d == dimensionCount) {
			d = 0;
		}
		
		if(node.above == null){
			nearestNeighboor = node.values;
			minDist = distance(node.values, target);
			return;
		}
		findParent(target, node.above, d);
	}