Some changes in markup and Javascript code

Fix head section in HTML
Move CSS above JS
JSHint `main.js`
Expose functions from `main.js` used somewhere else