Convert alert_message to normal function