Make the snippet editor a little prettier

And also fix a few important bugs with the JavaScript.