 		//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
 		   
 			//Free host pointers
-			free(h_origins);
+//			free(h_origins);
 			free(h_lines);
-			cudaFreeHost(h_lengths);
 
 			//Free the remaining device pointers
 			cudaFree(d_alpha);


			//Copy lengths from device to host
			//Note: can be even more asynchronous and should copy to different parts of h_lengths.
			checkCudaErrors(cudaMemcpyAsync(h_lengths, 
						d_lengths, 
						(dataCount/steps)*sizeof(float), 
						cudaMemcpyDeviceToHost,
						lengths));

		//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
			

	//Allocate space to store origin data
	float4 *d_origins, *h_origins;
	checkCudaErrors(cudaMalloc(&d_origins, dataCount/(2*blockSize)*sizeof(float4)));
//	h_origins = (float4*) malloc(BIGnroflines * sizeof(float4));

	//Allocating the array to store the length data, both for host and device
	float *d_lengths, *h_lengths;
	checkCudaErrors(cudaMalloc(&d_lengths, dataCount*sizeof(float)));
	status = cudaMallocHost((void**)&h_lengths, BIGnroflines*sizeof(float));
	if (status != cudaSuccess)
		printf("Error allocating pinned host memory.\n");

	//Allocating the array to store the radius data, both for host and device
	float *d_radii, *h_radii;
	checkCudaErrors(cudaMalloc(&d_radii, dataCount*sizeof(float)));
//	h_radii = (float*) malloc(BIGnroflines*sizeof(float));

	//Allocating arrays to store the alpha and beta data to compute winding numbers.
	float *d_alpha, *d_beta;
