Refactor layout from main.js into CustomLayout.js