changing qual_max to QUAL_MAX, to help disambiguate between macro and
variable defines