Big JSHint based cleanup

* Fixed missing semicolons
* Correct iteration of objects - ensure ```hasOwnProperty()``` calls where appropriate
* Fixed missing braces around if statements
* Removed old commented code
* Use dot notation where appropriate for readability