Refactored the code to match my style.

I find it mildly amusing that there seems to be no set coding style in these
files.