update javascript for refactoring