 			cudaFree(d_beta);
 			cudaFree(d_radius);
 			cudaFree(d_lengths);
-			cudaFree(d_origins);
+			cudaFree(d_origin);
 			cudaFree(d_lines);
 
 //Print some data to screen

	status = cudaStreamCreate(&windings);
	status = cudaStreamCreate(&windings2);
	status = cudaStreamCreate(&lengths);


	//Start main loop.
	for (int yindex = 0; yindex < BIGgridSize.y; yindex += gridSizeRK4.y) {

	float4 *d_origin;
	checkCudaErrors(cudaMalloc(&d_origin, 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");
	RK4init<<<gridSizeRK4,blockSizeRK4,0>>>(d_lengths, BIGstartloc, BIGxvec, BIGyvec);
	reduceSum<float><<<gridSizeRK4.x*gridSizeRK4.y/2,blockSizeRK4.x*blockSizeRK4.y,blockSizeRK4.x*blockSizeRK4.y*sizeof(float)>>>
		(d_lengths, d_lengths);
