Refactor/javascript