Simplify readAlerts() function.