Continued Javascript refactoring.