     // Read in the second file
     ////////////////////////////////////////////////////////////////////////////
 
-    fscanf(infile1, "%d", &NUM_GALAXIES);
-    printf("SIZE 1 # GALAXIES: %d\n",NUM_GALAXIES);
+    fscanf(infile1, "%d", &NUM_GALAXIES1);
+
+    size_of_galaxy_array = NUM_GALAXIES1 * sizeof(float);    
+    printf("SIZE 1 # GALAXIES: %d\n",NUM_GALAXIES1);
 
     h_alpha1 = (float*)malloc(size_of_galaxy_array);
     h_delta1 = (float*)malloc(size_of_galaxy_array);
 
-    for(int i=0; i<NUM_GALAXIES; i++)
+    for(int i=0; i<NUM_GALAXIES1; i++)
     {
         fscanf(infile1, "%f %f", &temp0, &temp1);
         h_alpha1[i] = temp0/scale_factor;

    // Read in the first file
    ////////////////////////////////////////////////////////////////////////////

    fscanf(infile0, "%d", &NUM_GALAXIES);

    int size_of_galaxy_array = NUM_GALAXIES * sizeof(float);    
    printf("SIZE 0 # GALAXIES: %d\n",NUM_GALAXIES);

    h_alpha0 = (float*)malloc(size_of_galaxy_array);
    h_delta0 = (float*)malloc(size_of_galaxy_array);
    float temp0, temp1;

    for(int i=0; i<NUM_GALAXIES; i++)
    {
        fscanf(infile0, "%f %f", &temp0, &temp1);
        h_alpha0[i] = temp0/scale_factor;

    cudaMemcpy(d_delta1, h_delta1, size_of_galaxy_array, cudaMemcpyHostToDevice );

    int x, y;
    int num_submatrices = NUM_GALAXIES1 / SUBMATRIX_SIZE;

    // Take care of edges of matrix.
    if (NUM_GALAXIES%SUBMATRIX_SIZE != 0)
