combined main.js code