     int max_station_blocks = (num_stations + block_size - 1) / block_size;
     dim3 num_blocks(num_stations, max_station_blocks);
     size_t shared_mem = num_threads.x * sizeof(float4c); /* acc. buffer */
-    shared_mem += num_threads.x * sizeof(float4c);       /* Jones cache */
-    shared_mem += block_size * sizeof(float4c);          /* vis baseline buffer */
-    shared_mem += num_threads.x * sizeof(float) * 4;     /* Source brightness */
-    shared_mem += num_threads.x * sizeof(float) * 3;     /* Source coords */
-
     oskar_correlate_point_time_smearing_cudak_2_f
     OSKAR_CUDAK_CONF(num_blocks, num_threads, shared_mem)
     (num_sources, num_stations, d_jones, d_source_I, d_source_Q, d_source_U,

        /* global source index */
        int t = sb * blockDim.x + threadIdx.x;

        /* Cache common values: StationI Jones matrices & source parameters */
        if (t < num_sources)
        {
            stationI[threadIdx.x] = jones[num_sources * blockIdx.x + t];
            sourceI[threadIdx.x]  = source_I[t];
            sourceQ[threadIdx.x]  = source_Q[t];
            sourceU[threadIdx.x]  = source_U[t];
            sourceV[threadIdx.x]  = source_V[t];
            sourceL[threadIdx.x]  = source_l[t];
            sourceM[threadIdx.x]  = source_m[t];
            sourceN[threadIdx.x]  = source_n[t];
        }

        /* Loop over other that make up the baseline handled by this thread block */
        for (int j = 0; j < STATION_BLOCK_SIZE; ++j)
        {
            /* global J station index */
            int idxStationJ = sJ0 + (blockIdx.y * STATION_BLOCK_SIZE) + j;
            if (idxStationJ < num_stations)
            {
                const float4c * __restrict__ stationJ = &jones[num_sources * idxStationJ];

                float l = sourceL[threadIdx.x];
                float m = sourceM[threadIdx.x];
                float n = sourceN[threadIdx.x];

                /* Compute bandwidth-smearing term. */
                float rb = oskar_sinc_f(uu[j] * l + vv[j] * m);

            __syncthreads();

            /* Accumulate per source visibilities into per chunk visibilities */
            if (threadIdx.x == 0 && sJ < num_stations)
            {
                int idx = sJ * (num_stations-1) - (sJ-1) * sJ/2 + blockIdx.x - sJ -1;

                for (int i = 0; i < blockDim.x; ++i)
                {
                    int tacc = (sb*num_sources) + i;
                    if (tacc < num_sources)
                    {
                        vis[idx].a.x += Vpq_source[i].a.x;
                        vis[idx].a.y += Vpq_source[i].a.y;
                        vis[idx].b.x += Vpq_source[i].b.x;
                        vis[idx].b.y += Vpq_source[i].b.y;
                        vis[idx].c.x += Vpq_source[i].c.x;
                        vis[idx].c.y += Vpq_source[i].c.y;
                        vis[idx].d.x += Vpq_source[i].d.x;
                        vis[idx].d.y += Vpq_source[i].d.y;
                    }
                }
            } /* Accumulate to baseline for the source chunk */
        } /* Loop over other stations that make up the baseline (I-J) */
    } /* Loop over blocks of sources */

} /* version 2 */


