What dynare does before metropolis hastings!

Just for the better understanding:

When I run a bayesian estimation, what is dynare doing before the metropolis hastings iteration? From the code I know that dynare is something optimizing. But what?
So far I think this is going on:

  1. Declare the prior distributions to give informations to the parameters.
  2. Calculate the likelihood of the model (with the kalman filter?).
  3. Try to minimize the negative likelihood of the model to estimate the parameters?? Is this the optimisation step??
  4. Explore the posterior statistical propeties of the parameters with the metropolis hastings algorithm (because integration is too difficult), by using the bayes-rule.

Did I understand the estimation right?

This is what Dynare does:

  1. Compute the steady state, (log-)linearizes the model around it and solves
    the linear model. The solution can always be written as a dynamic model
    of order 1 .
    2. Compute the likelihood for a given thanks to Kalman Filter and Gaussian
    shocks assumption.
  2. Multiply it by the prior density of the parameter to get the posterior kernel density.
    4. Maximizes the posterior Kernel density (numerical algorithm) by iterating
    the steps 2 and 3.
    5. Uses Metropolis Hastings algorithm to compute the full distribution of the