 		
 		//CudaPolygon current_store = current_polygon;
 		//doesn't have the stack?
-		index_t to_visit[CUDA_Stack_size];
+		short idx = threadIdx.x;
+		__shared__ index_t to_visit[128][CUDA_Stack_size];
 		index_t to_visit_pos = 0;
 
-		__shared__ index_t has_visited[64][CUDA_Stack_size];
-		__shared__ index_t has_visited_nb[64];
+		__shared__ index_t has_visited[33][CUDA_Stack_size];
+		__shared__ index_t has_visited_nb[33];
 		
 		bool has_visited_flag = false;
 		index_t facetidx_in_block = (index_t)threadIdx.x / k_f;

					//the neighbor seed is new!
					if (!has_visited_flag)
					{
						to_visit[to_visit_pos++] = ns;
						//has_visited[has_visited_nb++] = ns;
						atomicAdd(&has_visited_nb[facetidx_in_block], 1);
						index_t idx = has_visited_nb[facetidx_in_block] - 1;

		
		has_visited_nb[facetidx_in_block] = 0;
		//load \memory[facets_nn] 1 time.
		to_visit[idx][to_visit_pos++] = facets_nn[pid + tid * k_f];
		//has_visited[has_visited_nb++] = to_visit[0];
		atomicAdd(&has_visited_nb[facetidx_in_block], 1);
		has_visited[facetidx_in_block][pid] = to_visit[idx][0];
		__syncthreads();
		//----------------Time Consuming 1 ms----------------
		//has_visited[facetidx_in_block][has_visited_nb[facetidx_in_block]++] = to_visit[0];
