JS refactoring.