Managing layouts in code