Refactor javascript.js for an easy browserfy