Some minor refactoring of layouts to reduce code size and increase clarity