Random improvements

Mainly fixing documentation, adhering to MediaWiki code conventions, etc.

Left a few @fixme's where I saw things that didn't look right but wasn't sure on how to fix them.
This global is used on line 87.