     cudaGetDeviceProperties(&prop, 0);
     iterations = (prop.multiProcessorCount + 1) / 2;
 
-    // Add here allocations for managed memory
-    CUDA_CHECK( cudaMallocManaged((void**)&A, sizeof(double) * N) );
-    CUDA_CHECK( cudaMallocManaged((void**)&B, sizeof(double) * N) );
-    CUDA_CHECK( cudaMallocManaged((void**)&C, sizeof(double) * N) );
-    
-    for(int i = 0; i < N; ++i) {
-        A[i] = 1.0;
-        B[i] = 2.0;
-    }
 
-
-    
-    // Check the timings of default stream first
-    default_stream(C, A, B, N, &gputime_ref, ThreadsInBlock,
-                   iterations);
-    //free memory allocations
-    CUDA_CHECK( cudaFree((void*)A) );
-    CUDA_CHECK( cudaFree((void*)B) );
-    CUDA_CHECK( cudaFree((void*)C) );
-
-
-    int errorsum = 0;
-
-    // Now do it with streams, note that each stream will need to allocate its
+    // Now do the addition with streams, note that each stream will need to allocate its
     // own memory area 
-    // Here we loop over the test. On each iteration, we double the number
-    // of streams
-    for(int strm = 0; strm < N_TESTS; strm++) {
-        int stream_count = 1<<strm;
-        create_streams(stream_count, N, &s);
-
-        //set value
-        for(int i = 0; i < stream_count; ++i) {
-           for(int j = 0; j < s[i].len; ++j) {
-              s[i].A[j] = 1.0;
-              s[i].B[j] = 2.0;
-           }
-        }
-        
-
-        streamtest(s, stream_count, &gputimes[strm], ThreadsInBlock, iterations);
-
-        ref_value = 3.0 * ITER_MULTIPLIER * iterations;
-        //check value
-        for(int i = 0; i < stream_count; ++i) {
-           for(int j = 0; j < s[i].len; ++j) {
-              errorsum += s[i].C[j] - ref_value;              
-           }
-        }
-        
-        destroy_streams(stream_count, s);
-    }
-
-
-    printf("Error sum = %i\n", errorsum);
-    printf("Time elapsed for reference run: %f\n", gputime_ref / 1000.);
-    for(int i = 0; i < N_TESTS; i++) {
-        printf("Time elapsed for test %2i:       %f\n", 1<<i,
-               gputimes[i] / 1000.);
-    }
+    int stream_count = 8;
+    create_streams(stream_count, N, &s);
+    streamtest(s, stream_count,  ThreadsInBlock, iterations);
+    destroy_streams(stream_count, s);
 
 
     return 0;


// Number of iterations in the kernel
#define ITER_MULTIPLIER 4
// Number of tests, number of streams doubles for each test. That is,
// there will be 2^N_TESTS streams in the last test
#define N_TESTS 4

// Information of stream for simple domain decomposition
struct stream {

        grid.x = (slen + tib - 1) / tib;
        threads.x = tib;
        
        //set value on CPU
        for(int j = 0; j < s[i].len; ++j) {
           s[i].A[j] = 1.0;
           s[i].B[j] = 2.0;
        }
        vector_add<<<grid, threads, 0, s[i].strm>>>(s[i].C, s[i].A, s[i].B, slen, iterations);
    }    

    for (int i = 0; i < nstreams; ++i) {
       //check value
        double errorsum = 0;
        const double ref_value = 3.0 * ITER_MULTIPLIER * iterations;
        cudaStreamSynchronize(s[i].strm);
        
        //TODO Here the CPU accesses C array, make sure it is allowed to. 
        for(int j = 0; j < s[i].len; ++j) {
            errorsum += s[i].C[j] - ref_value;              
        }
        printf("Errorsum is %g on stream %d\n", errorsum, i);
    }
}

// Create the streams and compute the decomposition
