Fix JSHint warnings, and other minor cleanup.