Simplify the JavaScript.