Use 'use strict;' at a broader function scope. This reduces JSHint warning count.
Fix JSHint warnings.

Partial port from afc88ed282145dfff9b8a66d4d67a9f049829b9f