Refactor: Minor Javascript refactoring.