Fixed some issues pointed out by lint.

Mostly using == where === should be used and redeclaring variables
because JS doesn't have block scope (TIL!)