Refactor layouts