Refining the JavaScript