Move initialization to function.
Prepare minimization.