                     //printf("score for thread %d location %d is %d with prev_score %d\n", thread_idx, j, score, prev_score);
                 }
 
-                max_score = maxscore[0];
+                max_score = maxscore[thread_idx % 32];
 
                 // While there are changes to the horizontal score values, keep updating the matrix.
                 // So loop will only run the number of time there are corrections in the matrix.


    start = clock64();

    //int16_t max_score = SHRT_MIN;
    //int16_t max_i = -1;
    //int16_t max_j = -1;
    int16_t max_score = maxscore[0];
    int16_t max_i = maxi[0];
    int16_t max_j = maxj[0];

    long long int serial = 0;



    }


    //for(uint32_t i = 0; i < graph_count; i++)
    //{
