threads = false;
      bool no_verbose = false;
      bool do_use_overflow = false;

      unsigned runno = 0;

      bool compress = true;
      std::string laser_file("");
      std::string hilo_file("");
      std::string output_file("");
      std::string stage1_file("");
      std::string pad_stage1_file("");

#ifdef NOVDB
      options.addCatagory("db","Configure connection to database");
      VSDBFactory::configure(&options,"db");
#endif
      VSAnalysisStage1::configure(options,profile);
      VSAnalysisStage2::configure(options,profile);

      triple<std::string, std::string, double> 
	array_pos("31d40m29.04s","-110d57m10.08s",1270);

      options.addCatagory("common", 
			  "Options common to multiple stages.");

      options.addCatagory("file", 
			  "Input and output files");

      options.findWithValue("array_pos", array_pos,
			    "Set the reference position for the array. The "
			    "coordinate triple should be specified as "
			    "latitude/longitude/elevation.",
			    "common");

      Angle latitude;
      Angle longitude;
      latitude.setFromDMSString(array_pos.first);
      longitude.setFromDMSString(array_pos.second);
      SphericalCoords earth_position;
      earth_position.setLatLong(latitude,longitude);
      double earth_elevation = array_pos.third;

      options.findBoolValue("no_db", no_db, true,
			    "Do not collect information from the database.",
			    "common");
      options.findBoolValue("no_l3", no_l3, true, 
			    "Do not use L3 time.",
			    "common");

      VSSimCoordTransform::configure(options,profile);

#ifndef NOTHREADS
      options.findBoolValue("no_threads", no_threads, true,
			"Disable multi-threaded operation. This may slow the "
			"analysis on machines with multiple processors, "
			"multiple cores, hyperthreading and when reading data "
			"from a slow source (such as NFS).");
#endif

      options.findBoolValue("no_verbose", no_verbose, true, 
			"Do not write anything to the terminal.");

      options.findBoolValue("do_merge_overflow", do_use_overflow, true,
			"Do attempt to merge events from the overflow bank.",
			"common");

      options.findBoolValue("compress", compress, true,
			"Compress data in output files where possible.",
			"file"); 
  
      options.findWithValue("o", output_file, 
			"Set the output file name. If the output file is "
			"empty a name defined by the run number will be used, "
			"for example: \"x12345_s2.h5\". "
			"The first instance of a question mark in the name "
			"will be replaced with the run number (there is no "
			"way to override this), for example: \"x?_s2.h5\" "
			"might be expanded to \"x12345_s2.h5\".",
			"file"); 

      options.
	findWithValue("laser", laser_file, 
		      "Set a comma-separated list of LASER calibration "
		      "files to be used in the analysis. "
		      "Calibration files can be preceded by a telescope "
		      "index (e.g. 3/x30001.h5) specifying the telescope "
		      "to which that laser calibration should be applied. "
		      "A calibration file without an index will be used for "
		      "all telescopes for which no specific calibration "
		      "was chosen (e.g. x30000.h5,3/x30001.h5 will "
		      "use x30000.h5 for T1-T3 and x30001.h5 for T4). "
		      "The LASER file(s) specified will "
		      "override any LASER data in the Stage 1 input file. "
		      "If this option is not given then the LASER data "
		      "embedded in the Stage 1 file will be used, or no "
		      "LASER calibration will be done if that data does "
		      "not exist. Whether the LASER file is actually used "
		      "in the analysis is determined by the stage 2 option "
		      "\"s2_no_laser\".",
		      "file");

      options.findWithValue("hilo", hilo_file, 
			    "Set the name of the Hi-Lo gain calibration file "
			    "to be used in the analysis.",
			    "file");

      options.findWithValue("stage1", stage1_file, 
			"Set the name of the stage 1 file corresponding to "
			"the VBF file. If no file is speicified then the "
			"VBF file is used to determine the run number and a "
			"filename based on the run number is used. If the "
			"file is not available the stage 1 analysis is run "
			"directly here, and its output written before the "
			"stage 2 analysis starts.",
			"file");

      options.findWithValue("pad_stage1", pad_stage1_file, 
			"Set the name of the stage 1 file to use for "
			"padding.",
			"file");

      options.findWithValue("runno", runno, 
			"Set the run number of the file. If not explictly "
			"set, the number will be determined from the VBF file "
			"or from its name. If no number can be determined "
			"the analysis will not proceed.",
			"common");

      if(!options.assertNoOptions())
	{
	  std::cerr << progname << ": unknown options: ";
	  for(int i=1;i<argc;i++)
	    if(*(argv[i])=='-') std::cerr <<'' << argv[i];
	  std::cerr << std::endl;
	  usage(progname, options, std::cerr);
	  exit(EXIT_FAILURE);
	}

      argv++,argc--;

      if(print_usage)
	{
	  usage(progname, options, std::cout);
	  exit(EXIT_SUCCESS);
	}

      int arg_req = 1;
      if(argc!= arg_req)
	{
	  std::cerr << progname << ": need " << arg_req
		    << " arguments, got " << argc << std::endl;
	  usage(progname, options, std::cout);
	  exit(EXIT_SUCCESS);
	}

      std::string vbf_file = *argv;
      argv++,argc--;
      VSSimpleVBFDispatcher::catchSignalAndStopProcessingFile(SIGINT);

      if(!hilo_file.empty())VSFileUtility::expandFilename(hilo_file);
      if(!output_file.empty())VSFileUtility::expandFilename(output_file);
      if(!stage1_file.empty())VSFileUtility::expandFilename(stage1_file);
      if(!pad_stage1_file.empty())
	VSFileUtility::expandFilename(pad_stage1_file);

      if(!no_verbose)
	std::cout 
	  << "Input file:   " << vbf_file << std::endl;

      VSOctaveH5Writer::setDefaultCompress(compress);

      // ----------------------------------------------------------------------
      // Pass zero through the (start of the) file.. extract the run number etc
      // ----------------------------------------------------------------------

      VBFSimpleRunInfoExtractor simple_run_info;
      VSSimpleVBFDispatcher dispatcher(&simple_run_info);
      dispatcher.processFile(vbf_file.c_str());

      if(!no_verbose)
	{
	  if(simple_run_info.hasRunNumber())
	    std::cout 
	      << "VBF run num:  " << simple_run_info.runNumber() << std::endl;
	  else
	    std::cout 
	      << "VBF run num:  unavailable from VBF file" << std::endl;
	  
	  if(simple_run_info.hasApproximateStartTime())
	    std::cout 
	      << "Approx time:  " 
	      << simple_run_info.approximateStartTime().toString()
	      << std::endl;
	  else
	    std::cout 
	      << "Approx time:  unavailable from VBF file" << std::endl;

	  if