 
     s_dst[(s_dst_row) * s_dst_width + (s_dst_col)] = BINARY_WHITE + ((1 - thinning_cond_ok) * s_src[s_src_row * s_src_width + s_src_col]);
 
-    global_mem_write(g_dst, g_row, g_col, g_width, g_height, s_dst[(s_dst_row) * s_dst_width + (s_dst_col)]);
-
-    s_equ[(s_equ_row) * s_equ_width + (s_equ_col)] = (s_src[(s_src_row) * s_src_width + (s_src_col)] == s_dst[(s_dst_row) * s_dst_width + (s_dst_col)]);
-
-    __syncthreads();
-
-    global_mem_write(g_equ, g_row, g_col, g_width, g_height, s_equ[(s_equ_row) * s_equ_width + (s_equ_col)]);
+    uint8_t write_data;
+
+    // write dst pixel value to g_dst
+    write_data = s_dst[(s_dst_row) * s_dst_width + (s_dst_col)];
+    global_mem_write(g_dst, g_row, g_col, g_width, g_height, write_data);
+
+    // write pixel equality information to g_equ
+    write_data = (s_src[(s_src_row) * s_src_width + (s_src_col)] == s_dst[(s_dst_row) * s_dst_width + (s_dst_col)]);
+    global_mem_write(g_equ, g_row, g_col, g_width, g_height, write_data);
 }
 
 // Computes the number of white to black transitions around a pixel.

    int s_dst_row = threadIdx.y;
    int s_dst_col = threadIdx.x;
    int s_dst_width = blockDim.x;

    int s_equ_row = threadIdx.y;
    int s_equ_col = threadIdx.x;
    int s_equ_width = blockDim.x;

    // load g_src & g_dst into shared memory
    load_s_src(g_src, g_row, g_col, g_width, g_height, s_src, s_src_row, s_src_col, s_src_width);


    uint8_t* s_src = &s_data[0];
    uint8_t* s_dst = &s_data[(blockDim.x + PAD_LEFT + PAD_RIGHT) * (blockDim.y + PAD_TOP + PAD_BOTTOM)];

    int g_row = blockIdx.y * blockDim.y + threadIdx.y;
    int g_col = blockIdx.x * blockDim.x + threadIdx.x;
