     int device_id = atoi(argv[6]);
     printf("n_batches=%d, batch_size=%d, dim=%d, kern_w=%d, kern_h=%d, n_kerns=%d\n", n_batches, batch_size, dim, kerns.width, kerns.height, kerns.num);
     
-    WORDVECS* wordvecs = (WORDVECS*) calloc(n_batches, sizeof(WORDVECS));
-    
-    //Allocate sentence lengths and read
-    for (int batch=0; batch < n_batches; batch++) {
-        wordvecs[batch].b_size = batch_size;
-        wordvecs[batch].dim = dim;
-        wordvecs[batch].lens = (long*) calloc(batch_size, sizeof(long));
-    }
-    
     // Read mini-batch sentence lengths
-    read_sentence_lens("sentence_lens.txt", wordvecs, n_batches);
-    
-    // Test sentence lens for a given mini-batch
-    int test_batch = 9, test_idx = 9;
-    if (DEBUG){
-        printf("i=%d, len=%ld \n", 0, wordvecs[test_batch].lens[0]);
-        for (int i=1; i < wordvecs[test_batch].b_size; i++) {
-            printf("i=%d, len=%ld \n", i, wordvecs[test_batch].lens[i] - wordvecs[test_batch].lens[i-1]);
-        }
-    }
-    
-    // Allocate word vectors and initialize
-    for (int batch=0; batch < n_batches; batch++) {
-        wordvecs[batch].w = (float*) calloc(wordvecs[batch].dim*wordvecs[batch].lens[batch_size-1], sizeof(float));
-        init_wordvecs(wordvecs[batch].w, wordvecs[batch].dim, wordvecs[batch].lens[batch_size-1]);
-    }
-    
-    //Testing initialization
-    if (DEBUG) {
-        printf("Input: \n");
-        if (test_idx == 0) {
-            print_mat(&(wordvecs[test_batch].w[0*dim]), wordvecs[test_batch].lens[test_idx], wordvecs[test_batch].dim);
-        } else {
-            print_mat(&(wordvecs[test_batch].w[wordvecs[test_batch].lens[test_idx-1]*dim]), wordvecs[test_batch].lens[test_idx]-wordvecs[test_batch].lens[test_idx-1], wordvecs[test_batch].dim);
-        }
-    }
-    
+    int* sent_lens = (int*) calloc(n_batches*batch_size, sizeof(int));
+    read_sentence_lens("sentence_lens.txt", sent_lens, n_batches*batch_size);
     
     //Allocate kernels and initilize
-    kerns.k = (float *) calloc(kerns.height*kerns.width*kerns.num, sizeof(float));
+    kerns.k = (float *)calloc(kerns.height*kerns.width*kerns.num, sizeof(float));
     init_kerns(kerns.k, kerns.num, kerns.width, kerns.height);
     
     // Test kernel initialization
     if (DEBUG) {
-        printf("CPU kernel values: \n");
         for (int i=0; i<kerns.num; i++) {
             printf("Kernel: %d\n", i);
             print_mat(&kerns.k[i*kerns.height*kerns.width], kerns.width, kerns.height);
             printf("\n\n");
         }
     }
-
-    
-    //Allocate and initialize outputs
-    OUTPUTS* outputs = (OUTPUTS*) calloc(batch_size, sizeof(OUTPUTS));
-    for (int batch=0; batch < n_batches; batch++) {
-        outputs[batch].b_size = batch_size;
-        outputs[batch].dim = kerns.num;
-        outputs[batch].lens = (long*) calloc(batch_size, sizeof(long));
-        init_out_lens(&(outputs[batch].lens), wordvecs[batch].lens, batch_size, kerns.width);
-    }
-    
-    // Test output lens for a given mini-batch
-    if (DEBUG) {
-        printf("i=%d, len=%ld, out_len=%ld \n", 0, wordvecs[test_batch].lens[0], outputs[test_batch].lens[0]);
-        for (int i=1; i < wordvecs[test_batch].b_size; i++) {
-            printf("i=%d, len=%ld, out_len=%ld \n", i, wordvecs[test_batch].lens[i] - wordvecs[test_batch].lens[i-1],  outputs[test_batch].lens[i]-outputs[test_batch].lens[i-1]);
-        }
-    }
-
-    
-    //Allocate outputs
-    for (int batch=0; batch < n_batches; batch++) {
-        outputs[batch].out = (float*) calloc(kerns.num*outputs[batch].lens[batch_size-1], sizeof(float));
-    }
-    
-    if (DEBUG) {
-        // CPU loop
-        for (int batch=0; batch < n_batches; batch++) {
-            conv1d(wordvecs[batch], kerns, outputs[batch]);
-        }
-        
-        //Testing computation
-        printf("CPU Output: \n");
-        if (test_idx == 0) {
-            print_mat(&(outputs[test_batch].out[0*kerns.num]), outputs[test_batch].lens[test_idx], kerns.num);
-        } else {
-            print_mat(&(outputs[test_batch].out[outputs[test_batch].lens[test_idx-1]*kerns.num]), outputs[test_batch].lens[test_idx]-outputs[test_batch].lens[test_idx-1], kerns.num);
-        }
-        
-        //Set back output results to zero.
-        for (int batch=0; batch < n_batches; batch++) {
-            memset(outputs[batch].out, 0, kerns.num*outputs[batch].lens[batch_size-1]*sizeof(float));
-        }
-    }
+    
+    // Define test idxs
+    int test_batch = 9, test_idx = 9;
+    
+    WORDVECS wordvec;
+    OUTPUTS output;
+
     
     //Select the device you want to run the code.
     cudaSetDevice(device_id);
+    printf("Using device: %d \n", device_id);
     
     // Allocate GPU WORDVEC, KERNS and OUTPUT. Planning to pass these structs by value.
     WORDVECS d_wordvec;



int main(int argc, char* argv[]){
    if (argc != 7) {
        printf("USAGE: ./conv_1d.o <n_batches> <batch_size> <dim> <kern_w> <n_kerns> <device_id>");
        exit(1);

    }
    printf("])\n");
}


void conv1d(WORDVECS wordvec, KERNS kerns, OUTPUTS output){
    /*
