Miscellaneous edits to JavaScript