Refactoring JS.