Refactor send_timed_alert()