Refactoring javascript and adding commit emphasis