Remove nesting and use correct params in error_and_warning_count