Minor improvements to JS, all seems to still be in working order