Code quality fixes to please JSHint