Small JS formatting and efficiency updates
Merge pull request #2640 from darkwing/small-js-updates

Small JS formatting and efficiency updates