Enable JSHint's `indent` option.

Now the code should have consistent indentation.
Move globals where they are used.