Reformatted the JS files for easier patching.
Bugfixes.