diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 4ba29cf6c92adc4966b9e06dbccb815007dd8c10..d564589ad46f549a049c4ca177f6bde0ffe47cc7 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -1647,7 +1647,8 @@ SubsamplesStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
 void
 SubsamplesStatement::writeOutput(ostream &output, const string &basename) const
 {
-  output << "subsamples_indx = get_new_or_existing_subsamples_indx('" << name1 << "','" << name2 << "');" << endl
+  output << "subsamples_indx = get_new_or_existing_ei_index('subsamples_index', '"
+         << name1 << "','" << name2 << "');" << endl
          << "estimation_info.subsamples_index(subsamples_indx) = {'" << name1;
   if (!name2.empty())
     output << "_" << name2;
@@ -1684,7 +1685,8 @@ SubsamplesEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
 void
 SubsamplesEqualStatement::writeOutput(ostream &output, const string &basename) const
 {
-  output << "subsamples_to_indx = get_new_or_existing_subsamples_indx('" << to_name1 << "','" << to_name2 << "');" << endl
+  output << "subsamples_to_indx = get_new_or_existing_ei_index('subsamples_index', '"
+         << to_name1 << "','" << to_name2 << "');" << endl
          << "estimation_info.subsamples_index(subsamples_to_indx) = {'" << to_name1;
   if (!to_name2.empty())
     output << "_" << to_name2;
@@ -1708,8 +1710,7 @@ BasicPriorStatement::BasicPriorStatement(const string &name_arg,
   subsample_name(subsample_name_arg),
   prior_shape(prior_shape_arg),
   variance(variance_arg),
-  options_list(options_list_arg),
-  first_statement_encountered(false)
+  options_list(options_list_arg)
 {
 }
 
@@ -1760,19 +1761,19 @@ BasicPriorStatement::get_base_name(const SymbolType symb_type, string &lhs_field
     lhs_field = "measurement_error";
 }
 
-void
-BasicPriorStatement::writePriorIndex(ostream &output, const string &lhs_field) const
-{
-  if (first_statement_encountered)
-    output << "prior_indx = 1;" << endl;
-  else
-    output << "prior_indx = size(estimation_info" << lhs_field << "_index, 2) + 1;" << endl;
-}
-
 void
 BasicPriorStatement::writeCommonOutput(ostream &output, const string &lhs_field) const
 {
-  writeShape(output, lhs_field);
+  assert(prior_shape != eNoShape);
+  output << lhs_field << ".shape = " << prior_shape << ";" << endl;
+
+  if (variance)
+    {
+      output << lhs_field << ".variance = ";
+      variance->writeOutput(output);
+      output << ";" << endl;
+    }
+
   writeCommonOutputHelper(output, "mean", lhs_field);
   writeCommonOutputHelper(output, "mode", lhs_field);
   writeCommonOutputHelper(output, "stdev", lhs_field);
@@ -1782,14 +1783,6 @@ BasicPriorStatement::writeCommonOutput(ostream &output, const string &lhs_field)
   writeCommonOutputHelper(output, "median", lhs_field);
   writeCommonOutputHelper(output, "truncate", lhs_field);
   writeCommonOutputHelper(output, "interval", lhs_field);
-  writeVarianceOption(output, lhs_field);
-}
-
-void
-BasicPriorStatement::writeShape(ostream &output, const string &lhs_field) const
-{
-  assert(prior_shape != eNoShape);
-  output << "estimation_info" << lhs_field << "(prior_indx).shape = " << prior_shape << ";" << endl;
 }
 
 void
@@ -1797,43 +1790,22 @@ BasicPriorStatement::writeCommonOutputHelper(ostream &output, const string &fiel
 {
   OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field);
   if (itn != options_list.num_options.end())
-    output << "estimation_info" << lhs_field << "(prior_indx)." << field
-           << " = " << itn->second << ";" << endl;
-
-  OptionsList::date_options_t::const_iterator itd = options_list.date_options.find(field);
-  if (itd != options_list.date_options.end())
-    output << "estimation_info" << lhs_field << "(prior_indx)." << field
-           << " = '" << itd->second << "';" << endl;
+    output << lhs_field << "." << field << " = " << itn->second << ";" << endl;
 }
 
 void
-BasicPriorStatement::writeVarianceOption(ostream &output, const string &lhs_field) const
+BasicPriorStatement::writePriorOutput(ostream &output, string &lhs_field) const
 {
-  if (variance)
+  if (subsample_name.empty())
+    lhs_field += ".prior(1)";
+  else
     {
-      output << "estimation_info" << lhs_field << "(prior_indx).variance = ";
-      variance->writeOutput(output);
-      output << ";" << endl;
+      output << "subsamples_indx = get_existing_subsamples_indx('" << name << "','');" << endl
+             << lhs_field << ".range_index = estimation_info.subsamples(subsamples_indx).range_index;" << endl
+             << "eisind = get_subsamples_range_indx(subsamples_indx, '" << subsample_name << "');" << endl;
+      lhs_field += ".subsample_prior(eisind)";
     }
-}
-
-void
-BasicPriorStatement::writeSubsampleName(ostream &output) const
-{
-  if (!subsample_name.empty())
-    output << ":" << subsample_name;
-}
-
-void
-BasicPriorStatement::writeSubsampleInfo(ostream &output, const string &lhs_field, const string name1, const string name2) const
-{
-  if (subsample_name.empty())
-    return;
-
-  output << "subsamples_indx = get_existing_subsamples_indx('" << name1 << "', '" << name2 << "');" << endl;
-  output << "range_indx = get_subsamples_range_indx(subsamples_indx, '" << subsample_name << "');" << endl;
-  output << "estimation_info" << lhs_field << "(prior_indx).date1 = estimation_info.subsamples(subsamples_indx).range(range_indx).date1;" << endl;
-  output << "estimation_info" << lhs_field << "(prior_indx).date2 = estimation_info.subsamples(subsamples_indx).range(range_indx).date2;" << endl;
+  writeCommonOutput(output, lhs_field);
 }
 
 PriorStatement::PriorStatement(const string &name_arg,
@@ -1845,28 +1817,14 @@ PriorStatement::PriorStatement(const string &name_arg,
 {
 }
 
-void
-PriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
-{
-  BasicPriorStatement::checkPass(mod_file_struct, warnings);
-  if (!mod_file_struct.prior_statement_present)
-    first_statement_encountered = true;
-  mod_file_struct.prior_statement_present = true;
-}
-
 void
 PriorStatement::writeOutput(ostream &output, const string &basename) const
 {
-  string lhs_field = ".parameters.prior";
-
-  writePriorIndex(output, lhs_field);
-  output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name;
-  writeSubsampleName(output);
-  output << "'};" << endl
-         << "estimation_info" << lhs_field <<"(prior_indx).name = '" << name << "';" << endl;
-
-  writeCommonOutput(output, lhs_field);
-  writeSubsampleInfo(output, lhs_field, name, "");
+  string lhs_field = "estimation_info.parameters(eifind)";
+  output << "eifind = get_new_or_existing_ei_index('parameter_prior_index', '"
+         << name << "', '');" << endl
+         << "estimation_info.parameter_prior_index(eifind) = {'" << name << "'};" << endl;
+  writePriorOutput(output, lhs_field);
 }
 
 StdPriorStatement::StdPriorStatement(const string &name_arg,
@@ -1880,30 +1838,17 @@ StdPriorStatement::StdPriorStatement(const string &name_arg,
 {
 }
 
-void
-StdPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
-{
-  BasicPriorStatement::checkPass(mod_file_struct, warnings);
-  if (!mod_file_struct.std_prior_statement_present)
-    first_statement_encountered = true;
-  mod_file_struct.std_prior_statement_present = true;
-}
-
 void
 StdPriorStatement::writeOutput(ostream &output, const string &basename) const
 {
   string lhs_field;
   get_base_name(symbol_table.getType(name), lhs_field);
-  lhs_field = "." + lhs_field + ".prior";
+  output << "eifind = get_new_or_existing_ei_index('" << lhs_field << "_prior_index', '"
+         << name << "', '');" << endl
+         << "estimation_info." << lhs_field << "_prior_index(eifind) = {'" << name << "'};" << endl;
 
-  writePriorIndex(output, lhs_field);
-  output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name;
-  writeSubsampleName(output);
-  output << "'};" << endl
-         << "estimation_info" << lhs_field << "(prior_indx).name = '" << name << "';" << endl;
-
-  writeCommonOutput(output, lhs_field);
-  writeSubsampleInfo(output, lhs_field, name, "");
+  lhs_field = "estimation_info." + lhs_field + "(eifind)";
+  writePriorOutput(output, lhs_field);
 }
 
 CorrPriorStatement::CorrPriorStatement(const string &name_arg1, const string &name_arg2,
@@ -1929,9 +1874,6 @@ CorrPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolid
            << "types." << endl;
       exit(EXIT_FAILURE);
     }
-  if (!mod_file_struct.corr_prior_statement_present)
-    first_statement_encountered = true;
-  mod_file_struct.corr_prior_statement_present = true;
 }
 
 void
@@ -1939,17 +1881,17 @@ CorrPriorStatement::writeOutput(ostream &output, const string &basename) const
 {
   string lhs_field;
   get_base_name(symbol_table.getType(name), lhs_field);
-  lhs_field = "." + lhs_field + "_corr.prior";
 
-  writePriorIndex(output, lhs_field);
-  output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name << "_" << name1;
-  writeSubsampleName(output);
-  output << "'};" << endl
-         << "estimation_info" << lhs_field << "(prior_indx).name1 = '" << name << "';" << endl
-         << "estimation_info" << lhs_field << "(prior_indx).name2 = '" << name1 << "';" << endl;
+  output << "eifind = get_new_or_existing_ei_index('" << lhs_field << "_prior_index', '"
+         << name << "', '" << name1 << "');" << endl
+         << "estimation_info." << lhs_field << "_prior_index(eifind) = {'"
+         << name << "_" << name1 << "'};" << endl;
 
-  writeCommonOutput(output, lhs_field);
-  writeSubsampleInfo(output, lhs_field, name, name1);
+  lhs_field = "estimation_info." + lhs_field + "_corr(eifind)";
+  writePriorOutput(output, lhs_field);
+
+  output << lhs_field << ".name1 = '" << name << "';" << endl
+         << lhs_field << ".name2 = '" << name1 << "';" << endl;
 }
 
 BasicOptionsStatement::~BasicOptionsStatement()
@@ -2118,7 +2060,6 @@ CorrOptionsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol
     }
   if (!mod_file_struct.corr_options_statement_present)
     first_statement_encountered = true;
-  mod_file_struct.corr_prior_statement_present = true;
 }
 
 void
diff --git a/ComputingTasks.hh b/ComputingTasks.hh
index db6535f4defb88f0eab990aa519e74258536013d..26f6359d4a449bed4379679d590c8a35a040ee6f 100644
--- a/ComputingTasks.hh
+++ b/ComputingTasks.hh
@@ -622,7 +622,6 @@ protected:
   const PriorDistributions prior_shape;
   const expr_t variance;
   const OptionsList options_list;
-  bool first_statement_encountered;
   BasicPriorStatement(const string &name_arg,
                       const string &subsample_name_arg,
                       const PriorDistributions &prior_shape_arg,
@@ -630,13 +629,9 @@ protected:
                       const OptionsList &options_list_arg);
   virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   void get_base_name(const SymbolType symb_type, string &lhs_field) const;
-  void writePriorIndex(ostream &output, const string &lhs_field) const;
-  void writeVarianceOption(ostream &output, const string &lhs_field) const;
   void writeCommonOutput(ostream &output, const string &lhs_field) const;
   void writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
-  void writeShape(ostream &output, const string &lhs_field) const;
-  void writeSubsampleName(ostream &output) const;
-  void writeSubsampleInfo(ostream &output, const string &lhs_field, const string name1, const string name2) const;
+  void writePriorOutput(ostream &output, string &lhs_field) const;
 };
 
 class PriorStatement : public BasicPriorStatement
@@ -647,7 +642,6 @@ public:
                  const PriorDistributions &prior_shape_arg,
                  const expr_t &variance_arg,
                  const OptionsList &options_list_arg);
-  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   virtual void writeOutput(ostream &output, const string &basename) const;
 };
 
@@ -662,7 +656,6 @@ public:
                     const expr_t &variance_arg,
                     const OptionsList &options_list_arg,
                     const SymbolTable &symbol_table_arg);
-  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   virtual void writeOutput(ostream &output, const string &basename) const;
 };
 
diff --git a/Statement.cc b/Statement.cc
index 6165b8fb328d4f4d398dab84407a2da241c3a978..8bdb38ed3237b1eca099c0f0c849fb0b87b79311 100644
--- a/Statement.cc
+++ b/Statement.cc
@@ -45,9 +45,6 @@ ModFileStructure::ModFileStructure() :
   dsge_var_estimated(false),
   bayesian_irf_present(false),
   estimation_data_statement_present(false),
-  prior_statement_present(false),
-  std_prior_statement_present(false),
-  corr_prior_statement_present(false),
   options_statement_present(false),
   std_options_statement_present(false),
   corr_options_statement_present(false),
diff --git a/Statement.hh b/Statement.hh
index 12101da056bd465bed8dee087fdd4484464f1a7d..33cc44d8385cf60aca0dcd92f49fb24dd1ea351a 100644
--- a/Statement.hh
+++ b/Statement.hh
@@ -89,12 +89,6 @@ public:
   bool bayesian_irf_present;
   //! Whether there is a data statement present
   bool estimation_data_statement_present;
-  //! Whether there is a prior statement present
-  bool prior_statement_present;
-  //! Whether there is a std prior statement present
-  bool std_prior_statement_present;
-  //! Whether there is a corr prior statement present
-  bool corr_prior_statement_present;
   //! Whether there is a options statement present
   bool options_statement_present;
   //! Whether there is a std options statement present