Refactor layout to new structure