Fix JSHint issues and trailing whitespace