     //cudaFree(secretGpu);
 
     printf("\n\n5\n\n");
-    for (i = 0; i < msg_size/matrix_size; i++) {
+    for (i = 0; i < msg_parts; i++) {
     //    printf("%d %f\n\n\n\n", i, results[i]);
         for (j = 0; j < matrix_size; j++) {
-            printf("%c", char((int)results[i][j]));
-        }
-    }
-    
-    float **unEncrypted = (float **)malloc(3 * sizeof(float *));
-    for (z = 0; z < msg_size/matrix_size; z++) {
+            printf("%d: %c\n", (int)results[i][j], char((int)results[i][j]));
+        }
+    }
+    
+    float **unEncrypted = (float **)malloc(msg_parts * sizeof(float *));
+    for (z = 0; z < msg_parts; z++) {
         unEncrypted[z] = (float *)malloc(matrix_size * sizeof(float));
         memset(unEncrypted[z], 0, nBytes);
     }
      
 
     cudaMemcpy(secretGpu, *invSKey, nBytes, cudaMemcpyHostToDevice);
-    for (i = 0; i < msg_size/matrix_size; i++) {
-        printf("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\nOOOOOOOOOOOOO\nOOOOOOOOOO\n");
+    for (i = 0; i < msg_parts; i++) {
+        printf("\n\n\nOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\nOOOOOOOOOOOOO\nOOOOOOOOOO\n");
         cudaMemcpy(msgGpu, results[i], nBytes, cudaMemcpyHostToDevice);
         mtxEncrypt<<<grid, block>>>(secretGpu, msgGpu, resultGpu, matrix_dims);
         cudaMemcpy(unEncrypted[i], resultGpu, nBytes, cudaMemcpyDeviceToHost);
         cudaDeviceSynchronize();
     }
     printf("HELLO");
-    for (i = 0; i < msg_size/matrix_size; i++) {
+    for (i = 0; i < msg_parts; i++) {
         for (j = 0; j < matrix_size; j++) {
             printf("%c", char((int)unEncrypted[i][j]));
         }

        }
    }
    // pad message if not divisible by matrix_dims^2
    if (msg_size % matrix_size != 0) {
        pad_msg(msg, matrix_dims);
        msg_size = strlen(msg);
    }
    printf("%s", msg);

    float *msg_vector = (float *)malloc(strlen(msg)*sizeof(float));

    printf("1\n");
    float **results = (float **)malloc(msg_size * sizeof(float *));
    printf("2\n");
    for (z = 0; z < msg_parts; z++) {
        results[z] = (float *)malloc(matrix_size * sizeof(float));
        memset(results[z], 0, nBytes);
    }
