Refactor the javascript
Merge branch 'master' into gh-pages