Separated Javascript into js/main.js for ease of maintenance