     dim3 grid((matrix_dims+block.x-1)/block.x, (matrix_dims+block.y-1)/block.y);
 
     for (i = 0; i < msg_size/matrix_size; i++) {
+        printf("\nlist: %f", *msg_vector_list[i]);
+        // printrow(msg_vector_list[i]); this was a sanity check.  i am sane.
+        
+        // this seems to be sending the same row over and over.  why?
         cudaMemcpy(msgGpu, msg_vector_list[i], nBytes, cudaMemcpyHostToDevice);
         mtxEncrypt<<<grid, block>>>(secretGpu, msgGpu, resultGpu, matrix_dims);
         cudaMemcpy(results[i], resultGpu, nBytes, cudaMemcpyDeviceToHost);
-        printf("\nRESULTS: %d\n", *results);
-    }
-    cudaDeviceSynchronize();
-
-    cudaFree(secretGpu);
+        cudaDeviceSynchronize();
+    }
+
     cudaFree(msgGpu);
     cudaFree(resultGpu);
+    cudaFree(secretGpu);
 
     printf("\n\n5\n\n");
     for (i = 0; i < msg_size/matrix_size; i++) {
-        printf("%d", i);
+    //    printf("%d %f\n\n\n\n", i, results[i]);
         for (j = 0; j < matrix_size; j++) {
-            printf("%d %d\n", i, results[i][j]);
+            printf("%d %f\n", i, results[i][j]);
         }
     }
 


#define ASCII_CHARS 128

__global__ void mtxEncrypt(float *secretKey, float *msg, float *result, int matrix_dims) {
    int tx = threadIdx.x;
    int ty = threadIdx.y;
    float Pvalue = 0;
  
  //  printf("secretKey: %3.1f, *secretKey: %3.1f, &secretKey: %3.1f, *msg: %3.1f\n", secretKey, *secretKey, &secretKey, *msg);
    for (int k = 0; k < matrix_dims; ++k) {
   //     printf("secretkey[k]: %    
        float secretElement = secretKey[ty * matrix_dims + k];
        float msgElement = msg[k * matrix_dims + tx];
        
  //      printf("\nMultiplying %f by %f: \n", secretElement, msgElement);
        Pvalue  += secretElement * msgElement;
    }
    
//    printf("PValue: %d", (int)Pvalue%ASCII_CHARS);
    result[ty * matrix_dims + tx] = (int)Pvalue%ASCII_CHARS;
}

void secretKey(float **SKey, float **invSKey, int matrix_dims) {
    int k,z;
    //*SKey = malloc((matrix_dims*sizeof(*SKey)) + matrix_dims*matrix_dims*sizeof(int **));
    //*invSKey = malloc(matrix_dims*matrix_dims*sizeof(int *));

    float xSKey[4][4] = {{8, 6, 9, 5},
                {6, 9, 5, 10},

    cudaMalloc((void **)&secretGpu, nBytes);


    printf("msg_size/matrix_size: %d \n", msg_size/matrix_size);
    printf("\nmsg_vector_list[1]: %d\n", *msg_vector_list[1]);


    cudaMalloc((void **)&resultGpu, nBytes);
    cudaMalloc((void **)&msgGpu, nBytes);


    cudaMemcpy(secretGpu, *SKey, nBytes, cudaMemcpyHostToDevice);
