Updated code to pass JSHint.