JSHint by Grunt and related code fixes