diff --git a/README.md b/README.md
index 74c31062cae562e63f173126fa9da49e63fa9f24..8ac99310769f95e294b4071568fa1a26f4e80e31 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ A number of tools and libraries are needed in order to recompile everything. You
 - [MATLAB](http://www.dynare.org/DynareWiki/BuildingDynareFromSource?action=AttachFile&do=view&target=dynare-mingw64-libs.zip) (if you want to compile MEX for MATLAB)
 - [GNU Octave](http://www.octave.org), with the development headers (if you want to compile MEX for Octave)
 - [Boost libraries](http://www.boost.org), version 1.36 or later
-- [Bison](http://www.gnu.org/software/bison/), version 2.3 or later (only if you get the source through Git)
+- [Bison](http://www.gnu.org/software/bison/), version 2.4 or later (only if you get the source through Git)
 - [Flex](http://flex.sourceforge.net/), version 2.5.4 or later (only if you get the source through Git)
 - [Autoconf](http://www.gnu.org/software/autoconf/), version 2.62 or later (only if you get the source through Git) (see [Installing an updated version of Autoconf in your own directory, in GNU/Linux](http://www.dynare.org/DynareWiki/AutoMake))
 - [Automake](http://www.gnu.org/software/automake/), version 1.11.2 or later (only if you get the source through Git) (see [Installing an updated version of AutoMake in your own directory, in GNU/Linux](http://www.dynare.org/DynareWiki/AutoMake))
@@ -257,24 +257,21 @@ Configure and make:
 
 - Install [Homebrew](http://mxcl.github.io/homebrew/) and [Homebrew Science](https://github.com/Homebrew/homebrew-science)
 - Install the following brews:
-```
-    brew install automake
-    brew install gsl
-    brew install boost
-    brew install gfortran
-    brew install matlab2tikz --HEAD
-    brew install libmatio --with-hdf5
-    brew install slicot --with-default-integer-8
-```
+    - ```brew install automake```
+    - ```brew install gsl```
+    - ```brew install bison```
+    - ```brew install boost```
+    - ```brew install gfortran```
+    - ```brew install matlab2tikz --HEAD```
+    - ```brew install libmatio --with-hdf5```
+    - ```brew install slicot --with-default-integer-8```
 - **(Optional)** To compile Dynare mex files for use on Octave, first install Octave following the [Simple Installation Instructions](http://wiki.octave.org/Octave_for_MacOS_X#Simple_Installation_Instructions_3). Then, you will probably also want to install graphicsmagick via Homebrew with `brew install graphicsmagick`.
 - **(Optional)** To compile Dynare's documentation, first install the latest version of [MacTeX](http://www.tug.org/mactex/). Then install `doxygen`, `latex2html` and `texi2html` via Homebrew with the following commands:
-```
-    brew install doxygen
-    brew install latex2html
-    brew install texi2html
-```
+    - ```brew install doxygen```
+    - ```brew install latex2html```
+    - ```brew install texi2html```
 - **(On OS X 10.7 Only)** Copy [FlexLexer.h](http://www.dynare.org/DynareWiki/BuildingDynareFromSource?action=AttachFile&do=view&target=FlexLexer.h) into the `preprocessor` directory (there was an error in the `FlexLexer.h` file distributed with 10.7)
 - Finally, switch to the root dynare directory. Ensure your path contains `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/sbin`. Run:
     - `autoconf -si`
-    - `./configure --with-matlab=/Applications/MATLAB_R2013a.app MATLAB_VERSION=8.1` for builds with Matlab or `./configure` for builds just using Octave
+    - `./configure --with-matlab=/Applications/MATLAB_R2013a.app MATLAB_VERSION=8.1 YACC=/usr/local/Cellar/bison/<<BISON VERSION>>/bin/bison`
     - `make`
diff --git a/doc/dynare.texi b/doc/dynare.texi
index 278ae251ff69adbadf21810f4e6b5a0d66118790..73a2bb54732363a43ed708541a94c194212b8f7d 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -5478,6 +5478,15 @@ calibrated model.
 
 @end table
 
+@vindex oo_.shock_decomposition
+The results are stored in the field @code{oo_.shock_decomposition}, which is a three 
+dimensional array. The first dimension contains the endogenous variables for 
+which the shock decomposition has been requested. The second dimension stores 
+in the first @code{M_.exo_nbr} columns the contribution of the respective shocks. 
+Column @code{M_.exo_nbr+1} stores the contribution of the initial conditions, 
+while column @code{M_.exo_nbr+2} stores the smoothed value of the respective 
+endogenous variable. The third dimension stores the time periods.  
+
 @end deffn
 
 
diff --git a/matlab/gmhmaxlik.m b/matlab/gmhmaxlik.m
index d59333d4bb585811696796ff1c0a5ea0bd889c04..b5789d230b844674846e7cf78d3479a73ff98f3e 100644
--- a/matlab/gmhmaxlik.m
+++ b/matlab/gmhmaxlik.m
@@ -122,7 +122,7 @@ while j<=MaxNumberOfTuningSimulations
     end% ... otherwise I don't move.
     prtfrc = j/MaxNumberOfTuningSimulations;
     if mod(j, 10)==0
-        dyn_waitbar(prtfrc,hh,sprintf('Acceptance ratios: %f [%f]',isux/j,jsux/jj));
+        dyn_waitbar(prtfrc,hh,sprintf('Acceptance ratio [during last 500]: %f [%f]',isux/j,jsux/jj));
     end
     if  j/500 == round(j/500)
         test1 = jsux/jj;
@@ -215,7 +215,7 @@ if strcmpi(info,'LastCall')
         end% ... otherwise I don't move.
         prtfrc = j/MaxNumberOfTuningSimulations;
         if mod(j, 10)==0
-            dyn_waitbar(prtfrc,hh,sprintf('Acceptance rates: %f [%f]',isux/j,jsux/jj));
+            dyn_waitbar(prtfrc,hh,sprintf('Acceptance ratio [during last 1000]: %f [%f]',isux/j,jsux/jj));
         end
         if j/1000 == round(j/1000) 
             test1 = jsux/jj;  
diff --git a/matlab/shock_decomposition.m b/matlab/shock_decomposition.m
index 34a3b4acf06d7b3847f3dab0772ed03020879cca..bdfed236e41ab4035f85f0c6402816aa8e547c38 100644
--- a/matlab/shock_decomposition.m
+++ b/matlab/shock_decomposition.m
@@ -1,6 +1,10 @@
 function oo_ = shock_decomposition(M_,oo_,options_,varlist)
 % function z = shock_decomposition(M_,oo_,options_,varlist)
-% Computes shocks contribution to a simulated trajectory
+% Computes shocks contribution to a simulated trajectory. The field set is
+% oo_.shock_decomposition. It is a n_var by nshock+2 by nperiods array. The
+% first nshock columns store the respective shock contributions, column n+1
+% stores the role of the initial conditions, while column n+2 stores the
+% value of the smoothed variables.
 %
 % INPUTS
 %    M_:          [structure]  Definition of the model
@@ -72,10 +76,11 @@ A = dr.ghx;
 B = dr.ghu;
 
 % initialization
+gend = eval(['size(oo.SmoothedShocks.' M_.exo_names(1,:),',1)']);
+epsilon=NaN(nshocks,gend);
 for i=1:nshocks
     epsilon(i,:) = eval(['oo.SmoothedShocks.' M_.exo_names(i,:)]);
 end
-gend = size(epsilon,2);
 
 z = zeros(endo_nbr,nshocks+2,gend);
 for i=1:endo_nbr
diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy
index 8e806bd90415127001c7101b98aa0efcf92fa44a..b6ec34311894ec8139a39451a5d92b21c0a9ce1f 100644
--- a/preprocessor/DynareBison.yy
+++ b/preprocessor/DynareBison.yy
@@ -18,43 +18,19 @@
  */
 
 %skeleton "lalr1.cc"
-%require "2.3"
+%require "2.4"
 %defines
 
-/* Prologue:
-   In Bison <= 2.3, it is inserted in both the .cc and .hh files.
-   In Bison >= 2.3a, it is inserted only in the .cc file.
-   Since Bison 2.4, the new %code directives provide a cleaner way of dealing
-   with the prologue.
-*/
-%{
-using namespace std;
-
+%code top {
 class ParsingDriver;
+}
 
+%code requires {
 #include "ExprNode.hh"
 #include "CodeInterpreter.hh"
+}
 
-/* Little hack: we redefine the macro which computes the locations, because
-   we need to access the location from within the parsing driver for error
-   and warning messages. */
-#define YYLLOC_DEFAULT(Current, Rhs, N)                 \
-  do {                                                  \
-    if (N)                                              \
-      {                                                 \
-        (Current).begin = (Rhs)[1].begin;               \
-        (Current).end   = (Rhs)[N].end;                 \
-      }                                                 \
-    else                                                \
-      {                                                 \
-        (Current).begin = (Current).end = (Rhs)[0].end;	\
-      }                                                 \
-    driver.location = (Current);                        \
-  } while(false)
-
-%}
-
-%name-prefix="Dynare"
+%name-prefix "Dynare"
 
 %parse-param { ParsingDriver &driver }
 %lex-param { ParsingDriver &driver }
@@ -79,7 +55,24 @@ class ParsingDriver;
   PriorDistributions prior_distributions_val;
 };
 
-%{
+%code {
+/* Little hack: we redefine the macro which computes the locations, because
+   we need to access the location from within the parsing driver for error
+   and warning messages. */
+#define YYLLOC_DEFAULT(Current, Rhs, N)                         \
+  do {                                                          \
+    if (N)                                                      \
+      {                                                         \
+        (Current).begin = YYRHSLOC(Rhs, 1).begin;               \
+        (Current).end   = YYRHSLOC(Rhs, N).end;                 \
+      }                                                         \
+    else                                                        \
+      {                                                         \
+        (Current).begin = (Current).end = YYRHSLOC(Rhs, 0).end;	\
+      }                                                         \
+    driver.location = (Current);                                \
+  } while(false)
+
 #include "ParsingDriver.hh"
 
 /* this "connects" the bison parser in the driver to the flex scanner class
@@ -87,7 +80,7 @@ class ParsingDriver;
  * current lexer object of the driver context. */
 #undef yylex
 #define yylex driver.lexer->lex
-%}
+}
 
 %token AIM_SOLVER ANALYTIC_DERIVATION AR AUTOCORR
 %token BAYESIAN_IRF BETA_PDF BLOCK USE_CALIBRATION
diff --git a/preprocessor/ExprNode.hh b/preprocessor/ExprNode.hh
index 65199d6608ddcd825e028e4dd20e6868fe42ae14..aebdead2b1f425953ad7b114f128ead84fd2536d 100644
--- a/preprocessor/ExprNode.hh
+++ b/preprocessor/ExprNode.hh
@@ -20,13 +20,13 @@
 #ifndef _EXPR_NODE_HH
 #define _EXPR_NODE_HH
 
-using namespace std;
-
 #include <set>
 #include <map>
 #include <vector>
 #include <ostream>
 
+using namespace std;
+
 #include "SymbolTable.hh"
 #include "CodeInterpreter.hh"
 #include "ExternalFunctionsTable.hh"
diff --git a/preprocessor/macro/MacroBison.yy b/preprocessor/macro/MacroBison.yy
index a7a6456e898f351fcd826b6f495674b9262bd90c..272af6a0f5908f5e781e3fd011b5ddb1262d571d 100644
--- a/preprocessor/macro/MacroBison.yy
+++ b/preprocessor/macro/MacroBison.yy
@@ -18,24 +18,14 @@
  */
 
 %skeleton "lalr1.cc"
-%require "2.3"
+%require "2.4"
 %defines
 
-/* Prologue:
-   In Bison <= 2.3, it is inserted in both the .cc and .hh files.
-   In Bison >= 2.3a, it is inserted only in the .cc file.
-   Since Bison 2.4, the new %code directives provide a cleaner way of dealing
-   with the prologue.
-*/
-%{
-using namespace std;
-
-#include "MacroValue.hh"
-
+%code top {
 class MacroDriver;
-%}
+}
 
-%name-prefix="Macro"
+%name-prefix "Macro"
 
 %parse-param { MacroDriver &driver }
 %parse-param { ostream &out }
@@ -51,6 +41,10 @@ class MacroDriver;
 %debug
 %error-verbose
 
+%code requires {
+#include "MacroValue.hh"
+}
+
 %union
 {
   string *string_val;
@@ -58,7 +52,7 @@ class MacroDriver;
   const MacroValue *mv;
 };
 
-%{
+%code {
 #include <cstdlib>  // Pour atoi()
 #include "MacroDriver.hh"
 
@@ -77,7 +71,7 @@ class MacroDriver;
       driver.error(loc, e.message);             \
     }
 
-%}
+}
 
 %token DEFINE LINE FOR IN IF ELSE ENDIF ECHO_DIR ERROR IFDEF IFNDEF
 %token LPAREN RPAREN LBRACKET RBRACKET EQUAL EOL LENGTH
diff --git a/preprocessor/macro/MacroValue.hh b/preprocessor/macro/MacroValue.hh
index d79c024c5d6113aea36f7ad428d9e7fe82db6f31..25016478120b5a4e1bbe2dd9e3249a8c7fb7b597 100644
--- a/preprocessor/macro/MacroValue.hh
+++ b/preprocessor/macro/MacroValue.hh
@@ -20,12 +20,12 @@
 #ifndef _MACRO_VALUE_HH
 #define _MACRO_VALUE_HH
 
-using namespace std;
-
 #include <string>
 #include <vector>
 #include <sstream>
 
+using namespace std;
+
 class MacroDriver;
 
 //! Base class for representing values in macro language