Code refactoring, relaxing JSHint