Made the code pass JS Hint

JS Hint complained about a few things, mixed tabs/spacing, missing semi-colons, a few scoping issues. Now passes :)