     outImage->x = image->x;
     outImage->y = image->y;
 
+    // copy filter to constant memory on device
     cudaMemcpyToSymbol(filter_c, filter_h, sizeof(Filter));
     cudaDeviceSynchronize();
 
-
-
+    // for each of the frames run the kernel
     for(i = 0; i < 301; i++) {
         sprintf(outstr, "outfiles/tmp%03d.ppm", i+1);
 

    clock_t begin, end;
    double time_spent = 0.0;


    /* here, do your time-consuming job */

    char instr[80];
    char outstr[80];
    int i = 0;

    PPMImage images[301];

    // for(i = 0; i < 301; i++) {
    //     sprintf(instr, "infiles/baby001.ppm", i+1);
    //     images[i] = *readPPM(instr);
    // }

    PPMPixel *imageData_d, *outputData_d, *outputData_h;
    Filter * filter_h = initializeFilter();

    cudaError_t cuda_ret;

    for(i = 0; i < 301; i++) {
        sprintf(instr, "infiles/tmp%03d.ppm", i+1);
        images[i] = *readPPM(instr);
    }
    PPMImage *image;
    image = &images[0];
    outputData_h = (PPMPixel *)malloc(image->x*image->y*sizeof(PPMPixel));

    cuda_ret = cudaMalloc((void**)&(imageData_d), image->x*image->y*sizeof(PPMPixel));
    if(cuda_ret != cudaSuccess) FATAL("Unable to allocate device memory");


    fclose(fp);
}

// Allocates memory and initializes a filter for 2D convolution
Filter * initializeFilter()
{
    int data[FILTER_SIZE * FILTER_SIZE] = {0, 0, 0, 0, 0,
