 
 /*
  * Searches through images (represented as a flat array of floats) looking for most likely
- * trajectories in the given list. Outputs a psiImagess image of best trajectories. Note that
- * for now only the single best trajectory starting at each pixel makes it to psiImagess. 
+ * trajectories in the given list. Outputs a results image of best trajectories. Note that
+ * for now only the single best trajectory starting at each pixel makes it to the results. 
  */
-__global__ void searchImages(int width, int height, int imageCount, float *images, 
-	int trajectoryCount, trajectory *tests, trajectory *psiImagess, float mean, int edgePadding)
+__global__ void searchImages(int trajectoryCount, int width, 
+	int height, int imageCount, int edgePadding, float *psiPhiImages, 
+	trajectory *trajectories, trajectory *results, float *imgTimes)
 {
 
 	// Get trajectory origin

		}
	}

	// TODO: should delete mask images here	

	float **psiImages = new float*[imageCount];
	float **phiImages = new float*[imageCount];

	// Allocate Device memory 
	trajectory *deviceTests;
	float *deviceImgTimes;
	float *devicePsiPhi;
	trajectory *deviceSearchResults;

	CUDA_CHECK_RETURN(cudaMalloc((void **)&deviceTests, sizeof(trajectory)*trajCount));
	CUDA_CHECK_RETURN(cudaMalloc((void **)&deviceImgTimes, sizeof(float)*imageCount));
	CUDA_CHECK_RETURN(cudaMalloc((void **)&devicePsiPhi, 
		2*sizeof(float)*pixelsPerImage*imageCount));
	CUDA_CHECK_RETURN(cudaMalloc((void **)&deviceSearchResults, 
		sizeof(trajectory)*pixelsPerImage));
	

	// Copy trajectories to search
