Linted

Removed trailing whitespace and uncessary semicolons.
Added some missing semicolons.
Cleaned up spacing a bit.
Fixed some duplicate variable declarations.

Still need to fix an out-of-scope warning on line 306, but I haven't got into the logic yet.