Change styles and layout according to rules