Revert wrong refactoring JS