merged js functions into main.js