updated red_hat function to reduce duplication.