UPDATED using grunt.
UPDATED minifying main.js
UPDATED refactored code is working now.
UPDATED moved javascript to the bottom of the body.