another JSHint fix and minor optimization