Refactor to pass the latest jslint
* Replace tabs with spaces
* Hoist vars to the top
* Normalise function() to function ()
* Refactor to remove confusing inline assignment statement
* Compare directly against undefined
* Clean up array definition