Extract main.js into separate files