Small tweaks to JS