Cleaned up with JSHint

Mainly function definitions within for loops and a whole bunch of
unnecessary or missing semicolons. Also prompting me to clean up some
messier functions that contain a lot of superfluous steps, so that's
actually a good way to begin refactoring.