Optimization of the code when in landscape