R refactor layout