JS refactoring ...