JS refactoring...