Refactored JavaScript style.