formatting and sorting of alerts