Moved javascript to main.js file