Optimization of the layout