Refactor layout