Minor JavaScript improvements