refactored code for Layout, charts, for landscape orientation