Some minor clean up for JavaScript code