 
 		// Ok, we don't have nice STL vectors to use, and we can't dynamically allocate memory with CUDA??
 		// We'll use a fixed length stack, increase this as required
-		int to_visit[100];
+		int to_visit[CUDA_STACK];
 		int to_visit_pos = 0;
 
 		to_visit[to_visit_pos++] = cur;
 
 		while (to_visit_pos) {
-			int next_search[100];
+			int next_search[CUDA_STACK];
 			int next_search_pos = 0;
 
 			while (to_visit_pos) {

		cudaFree(gpu_ret_indexes);

	}
}
	}


	__device__ void cudaSearchAtNodeRange(const CUDA_KDNode *nodes, const int *indexes, const Kd_tree_point *pts, const Kd_tree_point &query, int cur, double range, int *ret_index, double *ret_dist)
	{
		// Goes through all the nodes that are within "range"

