   cudaSetDevice(deviceIndex);
   CHECKED_CUDA(cudaStreamCreate(&stream));
 
-  auto * fieldDevice = buildCayleyField(nx, ny, nz, format);
+
+  // Set up scalar field
+  if (!path) {
+    fprintf(stderr, "No input file specified.\n");
+    return EXIT_FAILURE;
+  }
+  else if (strcmp("cayley", path) == 0) {
+    buildCayleyField();
+  }
+  else if (!readFile(path)) {
+    return EXIT_FAILURE;
+  }
+  fprintf(stderr, "Scalar field is [%d x %d x %d] (%d cells total)\n", nx, ny, nz, nx * ny * nz);
+  void* deviceMem = nullptr;
+  CHECKED_CUDA(cudaMalloc(&deviceMem, scalarField_host.size()));
+  CHECKED_CUDA(cudaMemcpy(deviceMem, scalarField_host.data(), scalarField_host.size(), cudaMemcpyHostToDevice));
+
 
   auto * tables = createTables(stream);
   auto * pyramid = createHistoPyramid(stream, tables, nx, ny, nz);

{
  cudaStream_t stream;
  GLFWwindow* win;
  FieldFormat format = FieldFormat::UInt8;
  uint32_t nx = 128;
  uint32_t ny = 128;
  uint32_t nz = 128;
  int deviceIndex = 0;

  for (int i = 1; i < argc; i++) {

      }
      i++;
    }
    else {
      if (path) {
        fprintf(stderr, "%s: input file already specified\n", argv[i]);
        return EXIT_FAILURE;
      }
      path = argv[i];
    }
  }


