Cleanup: Adding jshint, use-strict etc.

1. Adding jshint
2. Adding use-strict
3. Normalizing indentation
4. Avoiding variable hoisting where jshint saw variable redeclarations.
5. Fixing a few references to undeclared globals.
6. Adding semi-colons