Tweaked severely to pass "grunt jshint"