   printf("eight\n");
 
   Aggregator* sumOverBlock = NULL;
-  cudaErrorCheck(cudaMalloc((void**)&sumOverBlock, numBlocks * sizeof(Aggregator)));
+  errorCheck(cudaMalloc((void**)&sumOverBlock, numBlocks * sizeof(Aggregator)));
 
   printf("nine\n");
 
   extractFromBlock<<<numBlocks, 1, sharedMemoryOffset + numThreadsPerBlock * sizeof(Aggregator)>>>(sharedMemoryOffset, numThreadsPerBlock, sumOverBlock);
-  cudaErrorCheck(cudaPeekAtLastError());
-  cudaErrorCheck(cudaDeviceSynchronize());
+  errorCheck(cudaPeekAtLastError());
+  errorCheck(cudaDeviceSynchronize());
 
   printf("ten\n");
 


extern __shared__ unsigned char sharedMemory[];

#define cudaErrorCheck(code) { cudaAssert(code, __FILE__, __LINE__); }

void cudaAssert(cudaError_t code, const char* file, int line) {
  if (code != cudaSuccess) {
    fprintf(stderr, "cudaAssert: %s at %s:%d\n", cudaGetErrorString(code), file, line);
    exit(code);
  }
}

}

int main(int argc, char** argv) {
  int numBlocks = 3;
  int numThreadsPerBlock = 2;
  int sharedMemoryOffset = 4;

  printf("one\n");

  initialize<<<numBlocks, numThreadsPerBlock, numThreadsPerBlock * sizeof(Aggregator)>>>(sharedMemoryOffset);
  errorCheck(cudaPeekAtLastError());
  errorCheck(cudaDeviceSynchronize());

  printf("two\n");

