Simple JS refactoring.