diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index f45a4e3177b0ee94eb2138d9bf92d50b8d1b6710..e2f60fc99a667b80b4c8a4c462555f6a8702e944 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -2686,7 +2686,7 @@ InitialConditionDecompositionStatement::writeOutput(ostream &output, const strin
   output << "options_ = set_default_initial_condition_decomposition_options(options_);" << endl;
   options_list.writeOutput(output);
   symbol_list.writeOutput("var_list_", output);
-  output << "initial_condition_decomposition(M_, oo_, options_, var_list_, bayestopt_, estim_params_);" << endl;
+  output << "oo_ = initial_condition_decomposition(M_, oo_, options_, var_list_, bayestopt_, estim_params_);" << endl;
 }
 
 ConditionalForecastStatement::ConditionalForecastStatement(const OptionsList &options_list_arg) :
diff --git a/DynareBison.yy b/DynareBison.yy
index 8ec4ceeb8881c2e149e31869c776c8dc4430b3d7..53a9ea4267090ad0eaec7286882a3ee67fc7e472 100644
--- a/DynareBison.yy
+++ b/DynareBison.yy
@@ -114,7 +114,7 @@ class ParsingDriver;
 %token CPF_WEIGHTS AMISANOTRISTANI MURRAYJONESPARSLOW WRITE_EQUATION_TAGS METHOD
 %token NONLINEAR_FILTER_INITIALIZATION FILTER_ALGORITHM PROPOSAL_APPROXIMATION CUBATURE UNSCENTED MONTECARLO DISTRIBUTION_APPROXIMATION
 %token <string_val> NAME
-%token USE_PENALIZED_OBJECTIVE_FOR_HESSIAN INIT_STATE RESCALE_PREDICTION_ERROR_COVARIANCE GENERATE_IRFS
+%token USE_PENALIZED_OBJECTIVE_FOR_HESSIAN INIT_STATE FAST_REALTIME RESCALE_PREDICTION_ERROR_COVARIANCE GENERATE_IRFS
 %token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS NO_HOMOTOPY
 %token NOGRAPH POSTERIOR_NOGRAPH POSTERIOR_GRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS MODEL_NAME STDERR_MULTIPLES DIAGONAL_ONLY
 %token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED OUTFILE OUTVARS OVERWRITE
@@ -2827,6 +2827,7 @@ realtime_shock_decomposition_option : o_parameter_set
                                     | o_shock_decomposition_presample
                                     | o_shock_decomposition_forecast
                                     | o_save_realtime
+                                    | o_fast_realtime
                                     ;
 
 plot_shock_decomposition_options_list : plot_shock_decomposition_option COMMA plot_shock_decomposition_options_list
@@ -2860,6 +2861,9 @@ initial_condition_decomposition_option : o_icd_type
                                        | o_icd_write_xls
                                        | o_icd_plot_init_date
                                        | o_icd_plot_end_date
+                                       | o_nodisplay
+                                       | o_graph_format
+                                       | o_psd_fig_name
                                        ;
 
 homotopy_setup: HOMOTOPY_SETUP ';' homotopy_list END ';'
@@ -3240,6 +3244,7 @@ o_init_state : INIT_STATE EQUAL INT_NUMBER { driver.option_num("shock_decomp.ini
 o_shock_decomposition_presample : PRESAMPLE EQUAL INT_NUMBER { driver.option_num("shock_decomp.presample", $3); };
 o_shock_decomposition_forecast : FORECAST EQUAL INT_NUMBER { driver.option_num("shock_decomp.forecast", $3); };
 o_save_realtime : SAVE_REALTIME EQUAL vec_int { driver.option_vec_int("shock_decomp.save_realtime", $3); };
+o_fast_realtime : FAST_REALTIME EQUAL INT_NUMBER { driver.option_num("shock_decomp.fast_realtime", $3); };
 o_nodisplay : NODISPLAY { driver.option_num("nodisplay","1"); };
 o_psd_nodisplay : NODISPLAY { driver.option_num("plot_shock_decomp.nodisplay","1"); };
 o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
diff --git a/DynareFlex.ll b/DynareFlex.ll
index 1ebe6a5c74884bd1e4b0700589fdbd2d0d7a78bb..86f0075685e319d01121a6a3d125cf598f458067 100644
--- a/DynareFlex.ll
+++ b/DynareFlex.ll
@@ -594,6 +594,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>controlled_varexo {return token::CONTROLLED_VAREXO; }
 <DYNARE_STATEMENT>parameter_set {return token::PARAMETER_SET; }
 <DYNARE_STATEMENT>init_state {return token::INIT_STATE; }
+<DYNARE_STATEMENT>fast_realtime {return token::FAST_REALTIME; }
 <DYNARE_STATEMENT>save_realtime {return token::SAVE_REALTIME;}
 <DYNARE_STATEMENT>detail_plot {return token::DETAIL_PLOT;}
 <DYNARE_STATEMENT>interactive {return token::INTERACTIVE;}
diff --git a/macro/MacroDriver.cc b/macro/MacroDriver.cc
index bd15152b366c5830305a6035d95308bb256940ae..b0420b44146102257066810479d3cd5ef6ae3bec 100644
--- a/macro/MacroDriver.cc
+++ b/macro/MacroDriver.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2017 Dynare Team
+ * Copyright (C) 2008-2018 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -60,7 +60,11 @@ MacroDriver::parse(const string &f, const string &fb, const string &modfiletxt,
       }
     catch (boost::bad_lexical_cast &)
       {
-        file_with_endl << "@#define " << it->first << " = \"" << it->second << "\"" << endl;
+        if (!it->second.empty() && it->second.at(0) == '[' && it->second.at(it->second.length()-1) == ']')
+          // If the input is an array. Issue #1578
+          file_with_endl << "@#define " << it->first << " = " << it->second << endl;
+        else
+          file_with_endl << "@#define " << it->first << " = \"" << it->second << "\"" << endl;
       }
   file_with_endl << modfiletxt << endl;
 
diff --git a/macro/MacroFlex.ll b/macro/MacroFlex.ll
index 5125ffa73906f12668b492ffd99f9b3915f41a72..21a35a1c974b5262997f38854c5fdb3b0fb867ef 100644
--- a/macro/MacroFlex.ll
+++ b/macro/MacroFlex.ll
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2017 Dynare Team
+ * Copyright (C) 2008-2018 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -71,6 +71,8 @@ CONT \\\\
   yylloc->step();
 %}
 
+<STMT,EXPR,FOR_BODY,THEN_BODY,ELSE_BODY>["/"]["/"].*
+
 <INITIAL>^{SPC}*@#{SPC}*includepath{SPC}+\"([^\"\r\n:;|<>]*){1}(:[^\"\r\n:;|<>]*)*\"{SPC}*{EOL} {
                               yylloc->lines(1);
                               yylloc->step();
@@ -303,6 +305,16 @@ CONT \\\\
                               then_body_tmp.append(yytext);
                               yylloc->step();
                             }
+<THEN_BODY>^{SPC}*@#{SPC}*ifdef({SPC}|{CONT}) {
+                              nested_if_nb++;
+                              then_body_tmp.append(yytext);
+                              yylloc->step();
+                            }
+<THEN_BODY>^{SPC}*@#{SPC}*ifndef({SPC}|{CONT}) {
+                              nested_if_nb++;
+                              then_body_tmp.append(yytext);
+                              yylloc->step();
+                            }
 <THEN_BODY>.                { then_body_tmp.append(yytext); yylloc->step(); }
 <THEN_BODY><<EOF>>          { driver.error(if_stmt_loc_tmp, "@#if/@#ifdef/@#ifndef not matched by an @#endif or file does not end with a new line (unexpected end of file)"); }
 <THEN_BODY>^{SPC}*@#{SPC}*else{SPC}*(\/\/.*)?{EOL} {