Refactors layouts