refractoring the layout